Title: Apache reverse proxy and HTTP_HOST
Last modified: August 18, 2016

---

# Apache reverse proxy and HTTP_HOST

 *  [swirly](https://wordpress.org/support/users/swirly/)
 * (@swirly)
 * [20 years, 8 months ago](https://wordpress.org/support/topic/apache-reverse-proxy-and-http_host/)
 * 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/](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)

 *  [cniemira](https://wordpress.org/support/users/cniemira/)
 * (@cniemira)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/apache-reverse-proxy-and-http_host/#post-265839)
 * >  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](http://httpd.apache.org/docs/2.0/mod/mod_proxy.html#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.

## Tags

 * [installation](https://wordpress.org/support/topic-tag/installation/)
 * [proxy](https://wordpress.org/support/topic-tag/proxy/)

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 1 reply
 * 2 participants
 * Last reply from: [cniemira](https://wordpress.org/support/users/cniemira/)
 * Last activity: [19 years, 10 months ago](https://wordpress.org/support/topic/apache-reverse-proxy-and-http_host/#post-265839)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
