Question

We are using a public apache web server as a reverse proxy for to show a drupal instance (to the client). The website should come up in http://publicSite/path The Reverse proxy contains basic apache configuration pointing a "subfolder" to the internal webserver. Something like:

ProxyPass /path http://internaldomain/
ProxyPassReverse /path http://internaldomain/

The problem is that Drupal 8 has no longer a $base_url and the site is broke (CSS, JS). Adding publicSite in the $settings['file_public_base_url'] does not help. CSS/JS and links to themes are still broken.

There is a settings section on a Reverse Proxy in the settings.php, but it does not address the issue on accessing the website from a /subfolder url. Any hints to solve this issue!?

Was it helpful?

Solution

You just need to reverse proxy all the asset directories like here (this proxies site preosasde via real site proreos):

ServerName preosasde

ProxyPass /themes/ http://proreos/themes/
ProxyPassReverse /themes/ http://proreos/themes/

ProxyPass /core/ http://proreos/core/
ProxyPassReverse /core/ http://proreos/core/

ProxyPass /vendor/ http://proreos/vendor/
ProxyPassReverse /vendor/ http://proreos/vendor/

ProxyPass /sites/ http://proreos/sites/
ProxyPassReverse /sites/ http://proreos/sites/

ProxyPass / http://proreos/asde/
ProxyPassReverse / http://proreos/asde/

Take care about the order of that entries and be aware that you will loose your users credentials (cause of the different domain).

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top