How to run WordPress behind a reverse proxy so that extensions still can detect the path

We run a Webshop example.com and a WordPress server at wordpress.example.com

The WordPress Server is connected to the main domain via a reverse proxy.

    ProxyPass /blog https://wordpress.example.com
    ProxyPassReverse /blog https://wordpress.example.com

This works quite okay. But some modules i.e. AMP cannot detect the sub path.

See also this question on the wordpress forum:

https://wordpress.org/support/topic/relamphtml-url-with-proxy/#post-12228181

What is the proper way to run wordpress behind such a proxy? Is there a better way to configure the proxy or the plugin?

Topic proxy Wordpress

Category Web


The following setup could work:

  • on wordpress.example.com make Apache listen to example.com as well
  • put the blog into the same subdirectory
  • proxy pass ProxyPass /blog https://wordpress.example.com
  • ProxyPreserveHost On

so the REQUEST_URI viewed from the wordpress host would be actually the real URL which was requested from the front proxy.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.