Drupal 8 + Nginx reverse proxy as subdir

Viewed 1346

we have a web server with drupal 8 running on nginx + php-fpm. We would like to use a reverse proxy server to publish the d8 website as www.somedomain.com/drupal8

The nginx config works just fine:

location /article_dev/ {
    proxy_buffers 32 32k;
    proxy_buffer_size 32k;
    proxy_pass http://192.168.158.148:80/;
    proxy_set_header    Host $host;
    proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header    X-Forwarded-Proto $scheme;
    proxy_set_header    X-Forwarded-By $server_addr:$server_port;
    proxy_set_header    X-Real-IP $remote_addr;
}

and in the settings.php I have set up the reverse proxy settings. The problem is that when I visit externaldomain.com/article_dev/ I see the d8 page, but no css etc is loaded since the paths to the resources are: externaldomain.com/path_to_ressource and not externaldomain.com/article_dev/path_to_ressource

In earlier versions of Drupal (6 and 7) It was possible to set the global $base_url to do the trick. Since D8 the $base_url has been depreated in the settings.php for reasons explained here https://www.drupal.org/node/2528988

This however is not bringing me any closer to achieving the goal to proxy the second site as a subdir...

Any help would be appreciated!

Regards, T

1 Answers
Related