PrusaOwners / OctoPrint-PrusaMeshMap

This plugin performs a mesh bed leveling operation then returns the results as an easy to read heatmap.
MIT License
133 stars 31 forks source link

Heatmap Image URL incorrect when using reverse proxy #23

Open ClassicGOD opened 6 years ago

ClassicGOD commented 6 years ago

My Octoprint instance is behind a Nginx reverse proxy and the heatmap image does not load.
Plugin generates incorrect url ignoring X-Script-Name for example for octoprint installation avaiable under https://myDomain.com/octoprint/ :

url of the image is: https://myDomain.com/plugin/PrusaMeshMap/static/img/heatmap.png

but it should be: https://myDomain.com/octoprint/plugin/PrusaMeshMap/static/img/heatmap.png

lord-carlos commented 6 years ago

I have this problem as well.

lord-carlos commented 6 years ago

For now I wrote a rule in nginx to rewrite the URL on the fly:

subs_filter_types text/javascript; subs_filter 'plugin/PrusaMeshMap' 'XXXX/plugin/PrusaMeshMap' g;

Where XXXX is my Subdirectory.

ppamidimarri commented 6 years ago

I think this should fix the problem... #33 Edit: I tested this and it fixes the problem. If you want to fix this problem on your RPi installation, open: /home/pi/oprint/lib/python2.7/site-packages/octoprint_PrusaMeshMap/templates/PrusaMeshMap_tab.jinja2 and change the second line:

<img id="PrusaMeshMap-heatmap" src="/plugin/PrusaMeshMap/static/img/heatmap.png" />

to

<img id="PrusaMeshMap-heatmap" src="plugin/PrusaMeshMap/static/img/heatmap.png" />

and a similar change to the path on line 3.