New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Setting url: to https in config.js causes a redirect loop #2796
Comments
What is the setting in |
Right now its http to work, but when I set it to https that's when I get the problem. |
Hello @xtceed and welcome to Ghost. Ghost is able do what you are trying to achieve but the Apache configuration doesn't seem correct to me. As @halfdan pointed out the |
Going to close this until there is some evidence that it is a bug rather than a configuration/environment issue. |
Also got the redirection loop of death when setting the url in config.js to https.... was attempting to proxy Ghost into an existing application. Fixed it by adding the request header 'X-Forwarded-Proto' = 'https'; Thanks to sebgie for the heads-up. |
Bravius could you give an example of what you mean? Thanks. |
xtceed: On Nginx I added
This stopped the 302 redirect loop on my HTTPS-only blog at https://tacticalsecret.com/ |
I can confirm this happens on a DigitalOcean Ghost app install. @ErisDS could you possibly provide the correct settings to fix this? Here's what I have now.
|
@dustinmatlock Please use the forum for support questions, thanks! |
I added proxy_set_header X-Forwarded-Proto https; entry on my ghost.conf (powered by Nginx). Thanks @jcjones ! It's solved now. |
I am having the same issue with my Ghost blog on Azure websites (IIS). When i change the config.js url to https from http it causes a redirect loop. |
You can set the blog to http in |
Adding the line |
I can confirm I had the redirect loop and with |
@jorge-3, would you know how to make this work on a DO droplet? Ubuntu 14.04. Thanks! |
@dustinmatlock, are you using Apache or Nginx? |
@drmyersii, it's Nginx, thanks. |
@dustinmatlock sorry, haven't worked with Digital Ocean. But if you're using nginx, the config that I'm using is similar to what you posted. Here's what I have:
The blog is live at https://jorge3.com |
Redirect loop confirmed on openshift. Reverting the protocol from Version |
@ErisDS this is a bug, not a configuration issue. Same thing happened in digitalocean. |
@MostDev if You want to enable native https in Ghost on Azure You must enable X-Forwarded-Proto for iisnode. There is an directive You must put into /site/wwwroot/iisnode.yml:
and remove all https redirection rules from web.config. Next change the configuration of Ghost in config.js:
Change to https in url if You want to have whole website with https or forceAdminSSL: true if You want just admin panel with https. For Azure users there is a dedicated repository from which the Marketplace app is forked time to time: https://github.com/felixrieseberg/Ghost-Azure |
When generating static sites. (For example- with buster) How should I deal with https. |
I can confirm that this fixed this issue for me as well. I was running this with Docker & Nginx. Changing the config in Ghost to https caused a redirect loop. Adding |
For those who are using apache, this is a sample working configuration to avoid the loop redirect
|
Thanks @gabrielepmattia This solved it for Apache. |
Newcomers, using the droplet image on digital ocean, check cloudflare configuration before messing with the nginx conf. The correct configuration for cloudflare is to select Full (strict) in SSL settings and Disable Universal SSL (at the bottom of the page) Once I disabled universal SSL and set my configuration to Full (strict) ghost was able to redirect the site to https:// every time without fault If you need to reset your nginx configuration to the default, delete your domains configuration in /etc/nginx/sites-available and /etc/nginx/sites-enabled and rerun |
I had the same issue, doing what @glcheetham suggested fixed it! |
Any ideas how to accomplish that with an haproxy? |
I've have an instance in an LXC container with Nginx as front proxy while in config.production.json, I just had to remove the This stopped looping nginx redirections |
This solve the Problem for me: Enable Header: Add to the Apache site config: Without this, ghost infinitely redirects:RequestHeader set "X-Forwarded-Proto" "https" Look at: https://blog.schenck.online/ghost-with-apache-and-https/ |
This comment has been minimized.
This comment has been minimized.
If you receive a redirect loop after setting your URL to HTTPS, it means your proxy is misconfigured and is telling Ghost the requests are HTTP. Ghost is then correctly redirecting to HTTPS. Ghost is setup to receive and correctly handle proxy headers, including X-Forwarded-Proto, X-Forwarded-Host and X-Forwarded-For. If your proxy is misconfigured and sends the wrong headers, you will end up in a redirect loop. If you aren't using Ghost CLI and are configuring your proxy yourself, then there are several excellent sources of information available to you:
If all that fails, we have https://forum.ghost.org where you can request support with configuring your proxy. |
Issue Summary
Creating a blog which only uses https requires that the links generated by blog.url to be https however I am not able to set this in config.js
If I enter the url: to my blog in config.js as http, then all of my internal links point to http causing users and search engines to get redirected unnecessarily.
Steps to Reproduce
Apache/2.2.22 (Debian) using the following options
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://example.com$1 [R=301,L]
ProxyRequests off
ProxyPass / http://127.0.0.1:2368/
ProxyPassReverse / http:/127.0.0.1:2368/
Ghost is running as http but needs to be able to write blog.url as whatever the user wants to specify.
Technical details
The text was updated successfully, but these errors were encountered: