Bad url on template_import.php causing Cross-Origin Request

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
nb1dev
Posts: 5
Joined: Thu Aug 24, 2023 10:15 am

Bad url on template_import.php causing Cross-Origin Request

Post by nb1dev »

Hi,

I'm running 1.2.26, migrated from 0.8.8h.
Everything seems to be good so far.

Except on the import template page.
When I load an XML, the page is trying to load : https://templates_import.php/?preview_only=true
So my browser block for a Cross-Origin Request as the URL isn't well formatted.

My server base URL (base_url) = https://cacti.mydomain.net/
My $url_path = '/';

What can cause the URL for this call to be like that ?
User avatar
TheWitness
Developer
Posts: 16929
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Bad url on template_import.php causing Cross-Origin Request

Post by TheWitness »

Report that in GitHub and for the time being save the XML to a file and import using a file.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
nb1dev
Posts: 5
Joined: Thu Aug 24, 2023 10:15 am

Re: Bad url on template_import.php causing Cross-Origin Request

Post by nb1dev »

I will open an issue in GitHub, but I am already importing using a XML file.
It's after uploading the XML file that the page refresh trying to open https://templates_import.php/?preview_only=true for the preview before the real import.

On others testing environment of Cacti 1.2.26 that have, this preview works well.
I am wondering if it's related to the migration, a recent change on the base_url or environment (php, apache, ...).
I will try to install a fresh 1.2.26 on the same server to eliminate apache/php.
User avatar
TheWitness
Developer
Posts: 16929
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Bad url on template_import.php causing Cross-Origin Request

Post by TheWitness »

Edit line 490 in templates_import.php and change to:

Code: Select all

url: (urlPath != '/' ? urlPath + '/':'') + 'templates_import.php?preview_only=true',
Let us know if that fixes it.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
nb1dev
Posts: 5
Joined: Thu Aug 24, 2023 10:15 am

Re: Bad url on template_import.php causing Cross-Origin Request

Post by nb1dev »

Thank you, it's working with this fix.

I've created the following report to trace the issue :
https://github.com/Cacti/cacti/issues/5701
User avatar
TheWitness
Developer
Posts: 16929
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Bad url on template_import.php causing Cross-Origin Request

Post by TheWitness »

Thanks for the bug report and thanks for confirming.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests