Generated URLs now take X-Forwarded-Host header sent by proxies into account for included host and port

This commit is contained in:
Gina Häußge 2014-12-29 20:48:33 +01:00
parent 292856e1bd
commit e3383fe4c1
2 changed files with 9 additions and 0 deletions

View file

@ -13,6 +13,7 @@
by versioneer
* [IRC] Don't hiccup on slic3r filament_diameter comments generated for multi extruder setups
* [ML] Fixed relative URL to sockjs endpoint, wasn't yet using the proper base url
* [unreported] Generated URLs now take X-Forwarded-Host header sent by proxies into account for included host and port
* Small fixes for timelapse creation:
- [#344](https://github.com/foosel/OctoPrint/issues/344) - Made timelapses capable of coping with missing captures in between by decrementing the image counter again if there
was an error fetching the latest image from the snapshot URL (backport of [1a7a468](https://github.com/foosel/OctoPrint/commit/1a7a468eb65fdf2a13b4c7a7723280e822c9c34b)

View file

@ -373,6 +373,14 @@ class ReverseProxied(object):
if scheme:
environ['wsgi.url_scheme'] = scheme
host = environ.get('HTTP_X_FORWARDED_HOST', '')
if not host:
host = settings().get(["server", "host"])
if host:
environ['HTTP_HOST'] = host
return self.app(environ, start_response)