Drupal 8 behind reverse proxy

You will need putty or another ssh program, or winscp, which is a ssh file manager.
Put this into your sites-available in drupal.YOUR_DOMAIN.com.conf file
Internal IP is just the IP address on your network (preferably static) drupal is on.

Summary
<VirtualHost *:80>
    RewriteEngine on
    RewriteCond %{HTTPS} !on
    RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301]
    ProxyPreserveHost On
    ServerName drupal.YOUR_GATEWAY.com
    ProxyPass / http://INTERNAL_IP/
    ProxyPassReverse / http://INTERNAL_IP/
</VirtualHost>

<VirtualHost *:443>
   # RewriteEngine on
   # RewriteCond %{HTTPS} !on
   # RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301]
   # RewriteRule ^ https://%{INTERNAL_IP/}%{REQUEST_URI} [END,QSA,R=permanent]
    ProxyPreserveHost On
    ServerName drupal.YOUR_GATEWAY(I use drupal.mydomain.com)
    ProxyPass / http://INTERNAL_IP/
    ProxyPassReverse / https://INTERNAL_IP/
</VirtualHost>
sudo ln -s /etc/httpd/sites-available/drupal.YOUR_DOMAIN.com.conf /etc/httpd/sites-enabled/drupal.YOUR_DOMAIN.com.conf

sudo nano /etc/httpd/conf/httpd.conf

Put this at very bottom if its not there:

IncludeOptional sites-enabled/*.conf

sudo apachectl restart

2 Likes