Changing URL to HTTPS causes redirect to localhost

If you’re looking for help, please provide information about your environment. If you delete this template and don’t provide any information, your topic will be automatically closed.

If you aren’t running the latest version of Ghost, the first thing we’ll ask you to do is update to the latest version of Ghost.

  • What’s your URL? lakshith.me
  • What version of Ghost are you using? 5.38

And

  • How was Ghost installed and configured? Installed on a lightsail server using bitnami
  • What Node version, database, OS & browser are you using? On Safari
  • What errors or information do you see in the console? GET requests return 302
  • What steps could someone else take to reproduce the issue you’re having? Change the URL from HTTP to https in ghost config.

I changed the URL from HTTP to HTTPS in ghost config. After that, going to my site redirects to 127.0.0.1:2368 .

I did what was asked to do here, Force HTTPS redirection with Apache.

The problem wasn’t resolved. Bug: Setting url: to https in config.js causes a redirect loop · Issue #2796 · TryGhost/Ghost · GitHub I found this which seems to solve the problem for others but not me. I added the line RequestHeader set X-Forwarded-Proto "https" in opt/bitnami/apache/conf/bitnami/bitnami.conf and
opt/bitnami/apache/conf/bitnami/bitnami-ssl.conf

It did not work. Did I correctly applied the solution? And what should I do from here. Thank you.

any solutions to this issue?

You’re replying to a year-old thread that links a 2020 GitHub discussion that seemed to have solutions in it, that many users reported work, and a post from Hannah saying that this isn’t a Ghost problem but a Proxy problem.

If you need help, please start a new thread (here on the forum, not on Github) and include all the details about your hosting setup, including what your proxy is and how you have your proxy configured. Include configuration files for the proxy, please!

Solved! I followed these Bitnami guides Access an application using only a single domain with Apache and Redirect custom domains to the Apache server previously. I had the exact same issue as mentioned by @Lakshith_Nishshanke .

After doing some digging, I solved the issue by modifying the/opt/bitnami/apache/conf/bitnami/bitnami-ssl and /opt/bitnami/apache/conf/vhosts/ghost-https-vhost.conf (may have other name if you gave it another name) files by adding the following in both files (gathered from the GitHub post):

<VirtualHost *:443>
    RequestHeader set X-Forwarded-Proto "https"

    ServerName ghost.example.com:443

    SSLEngine on
    SSLProtocol all -SSLv2
    SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5:!SEED:!IDEA
    SSLCertificateFile /home/user/.ssl/certificate.pem
    SSLCertificateKeyFile /home/user/.ssl/private_key.key

    <Location "/">
        ProxyPreserveHost On
        ProxyPass http://127.0.0.1:2368/
        ProxyPassReverse http://127.0.0.1:2368/
    </Location>
</VirtualHost>
1 Like