Multiple reverse proxies create unreadable hostname #1576

Closed
opened 2025-12-29 16:33:08 +01:00 by adam · 4 comments
Owner

Originally created by @callumstrubi on GitHub (Feb 27, 2018).

Issue type

[ ] Feature request
[x] Bug report
[ ] Documentation

Environment

  • Python version: 3.4.5
  • NetBox version: 2.2.10

Description

Environment: CentOS 7 with local postgres database configured as per instructions with supervisor and gunicorn.

Front-end web traffic arrives at a different host entirely that reverse proxies the traffic onto the apache service running the netbox service.

Web Traffic > Front-End Proxy Server > Back-End Proxy server running WSGI > WSGI Service from Supervisor > Netbox Code

When using an additional reverse proxy that points to apache and then onto the supervisor service you end up with an X-FORWARDED-HOST that contains all of the hostnames and as such cannot be loaded (does not match RFC pattern). Django has some ways of dealing with this with some custom projects, but a simpler (though less secure) fix was to disable use of X-FORWARDED-HOST. Proper support for this could be trivial with Django middleware.

Originally created by @callumstrubi on GitHub (Feb 27, 2018). <!-- Before opening a new issue, please search through the existing issues to see if your topic has already been addressed. Note that you may need to remove the "is:open" filter from the search bar to include closed issues. Check the appropriate type for your issue below by placing an x between the brackets. For assistance with installation issues, or for any other issues other than those listed below, please raise your topic for discussion on our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please note that issues which do not fall under any of the below categories will be closed. Due to an excessive backlog of feature requests, we are not currently accepting any proposals which extend NetBox's feature scope. Do not prepend any sort of tag to your issue's title. An administrator will review your issue and assign labels as appropriate. ---> ### Issue type [ ] Feature request <!-- An enhancement of existing functionality --> [x] Bug report <!-- Unexpected or erroneous behavior --> [ ] Documentation <!-- A modification to the documentation --> <!-- Please describe the environment in which you are running NetBox. (Be sure to verify that you are running the latest stable release of NetBox before submitting a bug report.) If you are submitting a bug report and have made any changes to the code base, please first validate that your bug can be recreated while running an official release. --> ### Environment * Python version: 3.4.5<!-- Example: 3.5.4 --> * NetBox version: 2.2.10<!-- Example: 2.1.3 --> <!-- BUG REPORTS must include: * A list of the steps needed for someone else to reproduce the bug * A description of the expected and observed behavior * Any relevant error messages (screenshots may also help) FEATURE REQUESTS must include: * A detailed description of the proposed functionality * A use case for the new feature * A rough description of any necessary changes to the database schema * Any relevant third-party libraries which would be needed --> ### Description Environment: CentOS 7 with local postgres database configured as per instructions with supervisor and gunicorn. Front-end web traffic arrives at a different host entirely that reverse proxies the traffic onto the apache service running the netbox service. Web Traffic > Front-End Proxy Server > Back-End Proxy server running WSGI > WSGI Service from Supervisor > Netbox Code When using an additional reverse proxy that points to apache and then onto the supervisor service you end up with an X-FORWARDED-HOST that contains all of the hostnames and as such cannot be loaded (does not match RFC pattern). Django has some ways of dealing with this with some custom projects, but a simpler (though less secure) fix was to disable use of X-FORWARDED-HOST. Proper support for this could be trivial with Django middleware.
adam closed this issue 2025-12-29 16:33:08 +01:00
Author
Owner

@jeremystretch commented on GitHub (Feb 27, 2018):

Thank you for taking the time to report a bug. We'll need more information to investigate this issue. Per the contributing guidelines please ensure that you have included all of the following:

  • The environment in which NetBox is running
  • The exact steps that can be taken to reproduce the issue
  • Any error messages generated
  • Screenshots (if applicable)

Please update your issue to include all of the information listed above. If no response is received within a week, this issue will be closed. Thanks!

@jeremystretch commented on GitHub (Feb 27, 2018): Thank you for taking the time to report a bug. We'll need more information to investigate this issue. Per the [contributing guidelines](https://github.com/digitalocean/netbox/blob/develop/CONTRIBUTING.md) please ensure that you have included all of the following: * The environment in which NetBox is running * The exact steps that can be taken to reproduce the issue * Any error messages generated * Screenshots (if applicable) Please update your issue to include all of the information listed above. If no response is received within a week, this issue will be closed. Thanks!
Author
Owner

@callumstrubi commented on GitHub (Feb 27, 2018):

No errors or screenshots are available but I have updated with some more detail to reproduce. This is an environmental issue not a code issue.

@callumstrubi commented on GitHub (Feb 27, 2018): No errors or screenshots are available but I have updated with some more detail to reproduce. This is an environmental issue not a code issue.
Author
Owner

@jeremystretch commented on GitHub (Mar 1, 2018):

This sounds like something that should be handled in the frontend. You should be able to modify the X-FORWARDED-HOST header in Apache and just pass what you want to Django, no?

@jeremystretch commented on GitHub (Mar 1, 2018): This sounds like something that should be handled in the frontend. You should be able to modify the `X-FORWARDED-HOST` header in Apache and just pass what you want to Django, no?
Author
Owner

@jeremystretch commented on GitHub (Mar 29, 2018):

Closing due to lack of activity and an apparent alternate solution.

@jeremystretch commented on GitHub (Mar 29, 2018): Closing due to lack of activity and an apparent alternate solution.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1576