Pylons / waitress

Waitress - A WSGI server for Python 3
https://docs.pylonsproject.org/projects/waitress/en/latest/
Other
1.44k stars 164 forks source link

Cleanup: Server Name deduction logic #329

Closed digitalresistor closed 3 years ago

digitalresistor commented 3 years ago

Waitress always used to assume that it would be running on a system where there was a correctly implemented DNS system that would return the hostname when doing a reverse DNS lookup on the IP address it was bound to, or that the system would return the IP address itself.

This is however not the case as seen in https://github.com/Pylons/waitress/issues/312, https://github.com/Pylons/waitress/issues/283, https://github.com/Pylons/waitress/issues/268, https://github.com/Pylons/waitress/issues/311 and issues in https://github.com/Pylons/waitress/issues/149.

So now the logic is simplified even further. We don't attempt do anything of the sort anymore at all. Waitress has learned a new configuration value called server_name. The default is waitress.invalid.

The only time that a user will see this value if the following is true: the request arrives over HTTP 1.0 and the remote client does not set a Host header.

In no other situation does the server_name value, which is used in the WSGI environment SERVER_NAME matter because it should be overridden with the Host header sent by the client, or if using a Proxy, can be set on Forwarded/X-Forwarded-Host.

Closes #312 Closes #150