• Hello dear wordpress users and developpers.

    I’m having great problem to install wordpress on a web server.

    The facts:
    ———-
    there is a gateway with a public IP (dynamic).
    There is a web server with a private IP behind the firewall.
    The request are made through the apache reverse proxy fonctionnality on the gateway
    (RewriteRule …… http://172.16.0.243/)

    The problem
    ———–
    A vast majority of the links in wordpress are made using the $_SERVER[‘HTTP_HOST’] usage. Because of the apache reverse proxy, the request are made using 172.16.0.243.

    But then, the links are served to the end client, wich know nothing of 172.16.0.243

    Resolution?
    ———–
    Is ther a way to solve this tuning either the apache2 config or the php config to force the HTTP_HOST variable?

    I’ve already set
    ServerName mywordpress.site
    UseCanonicalName On

    in apache2 without success. I’ve tried to use apache without virtual hosts also. No more success.

    TIA for any help.

    Laurent C.

Viewing 1 replies (of 1 total)
  • A vast majority of the links in wordpress are made using the $_SERVER[‘HTTP_HOST’] usage. Because of the apache reverse proxy, the request are made using 172.16.0.243.

    But then, the links are served to the end client, wich know nothing of 172.16.0.243

    Hi Laurent,
    You might try turning the ProxyPreserveHost directive on in the proxy server. This will allow the content server (the one actually serving WordPress) to correctly evaluate HTTP_HOST. I had exactly the same problem, and setting this up worked like a charm.

    Also, depending on how important IP verification is to you, you may also want find where REMOTE_ADDR is used in the source and change it to HTTP_X_FORWARDED_FOR. This will allow WordPress to correctly ID the source IP address. Otherwise, you’ll get the IP of your firewall as the source for all requests (which can confuse the comments and stats systems).

Viewing 1 replies (of 1 total)
  • The topic ‘Apache reverse proxy and HTTP_HOST’ is closed to new replies.