Docker installation on localhost forwarding index page to https

Hello, I am trying to set up a ghost blog on my dev machine so I can work on a new theme. However, when I try to access the index page, I get forwarded to https which then tells me that localhost refused my request. Interestingly, going to any other page including /ghost remains on http and works just fine. This has not happened to me before when working on Ghost themes on my dev machine.

To add confusion to this issue, I just exported the data from my old blog running on an old server that is no longer functioning. I set up a Ghost 0.6.2 Docker image so I could export the data and that had the same issue.

I am running Docker on Windows 10 Pro x86_64, if that makes any difference. Below is the Docker command I am using to build the container:

docker pull ghost:latest

docker run -dti \
-p 9999:2368 \
-e url="http://localhost:9999" \
-v "C:\Users\karai\Downloads\spooky\content:/var/lib/ghost/content" \
-m 128m \
--name spooky \
ghost:latest

Did your HTTP request to index actually reach to Ghost?
Cloud it be HSTS policy that makes your browser auto redirect to HTTPS? Maybe you can try access the page in incognito mode.

Oooh, Incognito Mode worked… This confuses me because I have another docker image (not ghost) running on localhost:8888 and localhost:1000 and they work totally fine.

Further testing shows that this seems to only be an issue with Chrome. Chrome’s Incogneto mode, Firefox, etc all work as expected but normal mode in Chrome seems to be pushing only the index page to HTTPS. And again, my non-ghost test sites don’t seem to be having this issue. Any idea why this might be happening?

I was suspecting HSTS causes redirection. But as far as I know HSTS should affect all pages from the origin not just index route. Anyway, my guess is maybe you had hosted Ghost in production mode(Ghost use HSTS in production mode right?) or other site that use HSTS on the port,then visited it with your browser. The browser got the HSTS headers so enforcing policy by redirecting all access to the address to HTTPS protocol. Maybe you could try clear HSTS cache of the browser.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.