Plugin Does Not Support X-Script-Name Option For Reverse Proxy #69

Closed
opened 2017-10-19 18:46:46 +01:00 by randuhmm · 3 comments
randuhmm commented 2017-10-19 18:46:46 +01:00 (Migrated from github.com)

I am using a Nginx server to reverse proxy to my OctoPrint server and I was able to follow the guide here to properly setup a different baseUrl:

https://github.com/foosel/OctoPrint/wiki/Configuration#server

It seems that this plugin does not honor this configuration and still uses the root path for http requests. For example:

/plugin/enclosure/...

I am using a Nginx server to reverse proxy to my OctoPrint server and I was able to follow the guide here to properly setup a different `baseUrl`: https://github.com/foosel/OctoPrint/wiki/Configuration#server It seems that this plugin does not honor this configuration and still uses the root path for http requests. For example: `/plugin/enclosure/...`
vitormhenrique commented 2017-10-19 19:01:20 +01:00 (Migrated from github.com)

I never tried to use the plugin using those configurations, I have to do some research to fix this issue, If you could I would suggest using the default configuration for now to get it working...
I'll take a look on the next release and see if I can fix it.

I never tried to use the plugin using those configurations, I have to do some research to fix this issue, If you could I would suggest using the default configuration for now to get it working... I'll take a look on the next release and see if I can fix it.
randuhmm commented 2017-10-20 01:49:05 +01:00 (Migrated from github.com)

I dug around a little bit and i believe that I have located the root cause of the issue. It seems that the flask routing properly updates the base url for plugins so this is simply a client-side issue. If the X-Script-Name header is passed with a value of /my-base, then the flask webserver properly sets the base path for all plugins such that the path will look like this:

/my-base/plugin/<plugin>

It seems that there is a globally accessibly variable that can be used to access this location in JavaScript so that any XHR calls can be properly constructed, the variable is:

window.PLUGIN_BASEURL

And, in the above case it should have the value:

/my-base/plugin/

(I may have gotten a few of the details wrong, I am riding the train right now and working off memory haha)

I don't mind taking a stab at this issue if you like. Thanks for your work on this plugin, I find it quite useful!

I dug around a little bit and i believe that I have located the root cause of the issue. It seems that the flask routing properly updates the base url for plugins so this is simply a client-side issue. If the `X-Script-Name` header is passed with a value of `/my-base`, then the flask webserver properly sets the base path for all plugins such that the path will look like this: `/my-base/plugin/<plugin>` It seems that there is a globally accessibly variable that can be used to access this location in JavaScript so that any XHR calls can be properly constructed, the variable is: `window.PLUGIN_BASEURL` And, in the above case it should have the value: `/my-base/plugin/` (I may have gotten a few of the details wrong, I am riding the train right now and working off memory haha) I don't mind taking a stab at this issue if you like. Thanks for your work on this plugin, I find it quite useful!
randuhmm commented 2017-12-18 22:54:33 +00:00 (Migrated from github.com)

👍

👍
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Gandalf/OctoPrint-Enclosure#69