Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: ProxyPreserveHost not passing port? |
|
Author |
|
r00ter
Joined: 02 Aug 2021 Posts: 9
|
Posted: Fri 17 Sep '21 15:45 Post subject: ProxyPreserveHost not passing port? |
|
|
ProxyPreserveHost works completely fine.
It is just that it won't seem to pass the port, so it always just displays "Port 80" on the ServerSignature on the proxied website (also running Apache in this case), even though you're on a secure virtualhost on the reverseproxy server.
The reverse proxy server is not even listening on port 80 for the proxied website, it's listening on 8084.
Does anyone know how I can fix this? Thanks |
|
Back to top |
|
tangent Moderator
Joined: 16 Aug 2020 Posts: 348 Location: UK
|
Posted: Fri 17 Sep '21 23:14 Post subject: |
|
|
You don't say why you want to display the port number of the proxy server rather than the proxied server. Indeed, the ServerSignature directive says:
The reason why you would want to enable such a footer line is that in a chain of proxies, the user often has no possibility to tell which of the chained servers actually produced a returned error message.
Notably, when set, ProxyPreserveHost only passes the host line from the incoming request, and that doesn't contain a port number. So it's no surprise you're getting the port number of the proxied server (port 80) rather than the front end proxy (port 8084).
Have you considered using "ProxyErrorOverride On", so all errors appear to come from the proxy rather than proxied server? Yes, ideally you do need to create custom error pages, but that would make the site look more professional rather than presenting Apache's terse unbranded error messages.
Alternatively, in the limit, you could arrange to pass the front end proxy port number in a request header to the proxied server:
Code: | <If "%{SERVER_PORT}" != "">
RequestHeader set X_SERVER_PORT %{SERVER_PORT}
</If> |
and then use an ErrorDocument with a custom page on the back end server to report that detail. But this would be a rather complex approach. |
|
Back to top |
|
|
|
|
|
|