Switching to https redirects blog to localhost and makes the blog not load

If you’re looking for some help, it’s important to provide as much context as possible so that people are able to assist you. Try to always mention:

  • What’s your URL? www.keplerobotics.in
  • What version of Ghost are you using? 3.17.1
  • What configuration? Production with https
  • What errors or information do you see in the console? None
  • What steps could someone else take to reproduce the issue you’re having? I cannot currently keep the website down as it’s a client’s website. But basically when converted to https the website will redirect to localhost

I am using the binami aws ghost image. When I setup https with Let’s Encrypt I saw that in pages with images I get mixed content warning. So after a bit of reading I saw you also have to change the url to https one. So after I did that the website redirects to localhost.

And I found that the solution was to setup a x-forwardes-proto header. But I am confused in where to do that. Although after a bit of reading I have added to the conf files which I think is the correct one, it’s still not working.

Here are the conf files:

htttp-app.conf
Include “/opt/bitnami/apps/ghost/conf/banner.conf”
ProxyPass /bitnami !
ProxyPass / http://127.0.0.1:2368/
ProxyPassReverse / http://127.0.0.1:2368/

htttp-prefix.conf
# Include file

RewriteEngine On
RewriteCond “%{HTTP_HOST}” ^ec2-([0-9]{1,3})-([0-9]{1,3})-([0-9]{1,3})-([0-9]{1,3})...amazonaws.com(:[0-9])?$
RewriteRule “^/?(.*)” “%{REQUEST_SCHEME}://%1.%2.%3.%4%5/$1” [L,R=302,NE]

Include “/opt/bitnami/apps/ghost/conf/httpd-app.conf”

htttp-vhosts.conf
<VirtualHost *:80>
ServerName ghost.example.com
ServerAlias www.ghost.example.com
DocumentRoot “/opt/bitnami/apps/ghost/htdocs”

Include "/opt/bitnami/apps/ghost/conf/httpd-app.conf"
RequestHeader set X-Forwarded-Proto "http"  # I added this line

<VirtualHost *:443>
ServerName ghost.example.com
ServerAlias www.ghost.example.com
DocumentRoot “/opt/bitnami/apps/ghost/htdocs”
SSLEngine on
SSLCertificateFile “/opt/bitnami/apps/ghost/conf/certs/server.crt”
SSLCertificateKeyFile “/opt/bitnami/apps/ghost/conf/certs/server.key”

Include "/opt/bitnami/apps/ghost/conf/httpd-app.conf"
RequestHeader set X-Forwarded-Proto "https" # I added this line 

If you change your URL to https, then you should only be sending https traffic to Ghost.

All http traffic should be redirected to https.

Bitnami have docs for this:

https://docs.bitnami.com/aws/apps/ghost/administration/force-https-apache/

:hot_face: After two days of searching finally I found it, and I am literally jumping with happiness :partying_face: :partying_face: and crying on the inside thinking about the time I had lost. :cry:
Here’s the solution
GitHub - bitnami/vms: Bitnami VMs

Thanks

Thank you @Hannah that was already done by a tool they provided and I had to do the solution I have specified too.