0
Hello, I’m having a problem... the application in question works perfectly at http, but I need to add a certificate and start the application by forcing ssl, but I ran into the problem where the thin server does not automatically redirect http to https and the error application...
This is the stretch where the application starts without ssl, working normally.
#Start without SSL
#echo "Start without SSL, VERIFY ssl_force in application.rb"
#RAILS_ENV=production bundle exec rails server -p 3000 -b '0.0.0.0'
And this is the stretch where I start thin to use ssl
#Start with SSL
echo "Start with SSL!"
RAILS_ENV=production bundle exec thin start -p 3000 -a '0.0.0.0' --ssl --ssl-key-file db/certs/privkey.key --ssl-cert-file db/certs/fullchain.cert
I’m using Docker on Centos7, so I use httpd and my httpd.conf is listening to both port 80 and port 443
Listen 80
Listen 443
And my virtues are that way
<VirtualHost 192.168.200.18:80>
ServerAdmin emaildoadm
ServerName **example.com.br**
DocumentRoot /var/www/html/
ErrorLog logs/**example.com.br**-error_log
CustomLog logs/**example.com.br**-access_log combined
DirectoryIndex index.html index.htm index.shtml
ProxyPass / http://192.168.200.18:3000/
ProxyPassReverse / http://192.168.200.18:3000/
ProxyPreserveHost On
ProxyTimeout 600
ProxyBadHeader Ignore
SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1
</VirtualHost>
<VirtualHost *:443>
ServerName **example.com.br**
SSLEngine on
SSLCertificateFile "/etc/letsencrypt/live/**example.com.br**/cert.pem"
SSLCertificateChainFile "/etc/letsencrypt/live/**example.com.br**/chain.pem"
SSLCertificateKeyFile "/etc/letsencrypt/live/**example.com.br**/privkey.pem"
ProxyPass / http://192.168.200.18:3000/
ProxyPassReverse / http://192.168.200.18:3000/
</VirtualHost>
So... the application boots normally using ssl and works... but to work I need to put https://example.com.br:3000 and not only example.com.br like in the old days... Someone’s got some light for it?