1

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!?

1

1 Answer 1

1

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).

4
  • Thank you for the solutions. Seems logic. I am trying to connect through a subfolder path. So drupal is installed at root of proreos, but the access should come from preosasde/drupal. I tried changin correcting the ProxyPass & ProxyPassReverse and although this is fine, drupal aims link resources to absolute paths. So if I am at preosasde/drupal the link to 'sites' will be /sites, aiming to find it at root...
    – Al-Punk
    Jul 6, 2016 at 14:28
  • Leaving them on, with the expense of having additional proxy-spaces blocked helps, but again, this is a problem once the website is configured to have clean-urls. URLs are linked now to absolute paths. It feels the use of a $base_url was neccessary in Drupal, pitty that functionality is removed
    – Al-Punk
    Jul 6, 2016 at 14:33
  • Bad problem, yes. I can do it with mod_rewrite because I have not too much paths to relink. 10 years ago, I would have re-programmed mod_proxy to rewrite the URLs :-) ... maybe there's an option for this? Don't know, sorry. Jul 6, 2016 at 14:57
  • Appreciate your feedback :)
    – Al-Punk
    Jul 7, 2016 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.