HTTPS redirects to HTTP sometimes

I faced a strange problem. Sometimes my requests, which are all HTTPS, redirect to HTTP and it causes Mixed Content error:

On Network tab I see how my HTTPS is being redirected to HTTP:

I don’t understand if it’s problem or mine, because there are no errors or redirections on development, only on production.

Hey @CunningLobster! I believe that our edge proxy passes the Location header as-is, so I suspect that your app itself is generating the HTTP URL that you see in the redirect. My guess (though I could be wrong!) is that it will need to be fixed on your end.

If you’re willing to share anything about the language or framework that you’re using, someone here might be able to help you troubleshoot this further.

(Edited to add: the X-Forwarded-Proto header might be relevant here.)

Thank you for your response!
It is a .NET Core application.
I am not experienced in working with hosting services, but I noticed that the hosting machines shut down after some time. And when I’m trying get my request from shut down machine I receive that error, also I need to re-login in my application.
Maybe that is a reason of my problem? And do hosting machines shut down occasionally in real-world projects?

Fly Machines can shut down automatically when (due to low traffic) they aren’t needed, and automatically started up when traffic increases again. (The benefit is that you don’t pay for their CPU or RAM when they’re not running.) It sounds like that’s what you’re observing. If you decide that you want your Machines to stay running at all times, you can set auto_stop_machines = false as described in the linked docs.

If your app is storing its login or session data in memory, then it would be lost every time a Machine shuts down and restarts, so that could certainly explain why you’re getting logged out. I’m not familiar with .NET Core, though, so I can only speculate.

Hope this helps!

Thank you very much!
I think that is the reason. When I’ve allowed anonymous for this request the problem was disapeared

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