Answers

Question and Answer:

  Home  WordPress Theme Development

⟩ Tell me how can I get WordPress working when I’m behind a reverse proxy?

In some setups, it’s necessary to use something other than the HTTP_HOST header to generate URLs. Reverse proxies take the original request and send it to one of a group of servers. To do so, it overwrites the HTTP_HOST with the internal server’s domain. When that domain is not publicly accessible, at best your images might not load correctly, at worst, you’ll be stuck in a redirect loop. To fix this, figure out which header has the right domain name and add a line to your wp-config.phpfile that overwrites HTTP_HOST with the correct hostname.

If you need to use SERVER_NAME, add this line to wp-config.php:

$_SERVER[‘HTTP_HOST’] = $_SERVER[‘SERVER_NAME’];

If you need to use HTTP_X_FORWARDED_HOST, add this line to wp-config.php:

$_SERVER[‘HTTP_HOST’] = $_SERVER[‘HTTP_X_FORWARDED_HOST’];

 170 views

More Questions for you: