Skip to content

Instantly share code, notes, and snippets.

@MaherSaif
Forked from abachman/apache-rails-proxy-ssl
Created October 18, 2021 12:10
Show Gist options
  • Save MaherSaif/f24f8b28d8bdf172e2e212cfd2ef2e23 to your computer and use it in GitHub Desktop.
Save MaherSaif/f24f8b28d8bdf172e2e212cfd2ef2e23 to your computer and use it in GitHub Desktop.
# proxying through apache to a local rails instance, http & https
# apache *.conf file
<VirtualHost *:80>
ServerName psl.localhost
ServerAlias cms.psl.localhost
ServerAlias *.psl.localhost
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
</VirtualHost>
<VirtualHost *:443>
ServerName psl.localhost
ServerAlias cms.psl.localhost
ServerAlias *.psl.localhost
SSLEngine on
SSLOptions +StrictRequire
SSLCertificateFile /home/adam/workspace/psl/cms/config/development/server.crt
SSLCertificateKeyFile /home/adam/workspace/psl/cms/config/development/server.key
SSLProxyEngine on # make sure apache knows SSL is okay to proxy
RequestHeader set X_FORWARDED_PROTO 'https' # make sure Rails knows it was an SSL request
ProxyPass / http://localhost:3000/ # NOTE: http not https
ProxyPassReverse / http://localhost:3000/ # NOTE: http not https
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment