HTTP to HTTPS redirection not working

Yesterday I managed to make this work by updating some rules in the DNS settings, however, all the traffic was being redirected through Cloudflare’s servers, which reduced the speed from 1Gbps to around 300Mbps, at least per connection. So I disabled the proxying and now the HTTP to HTTPS redirection isn’t working, is there any way to make HTTP to HTTPS redirection work? I don’t want my traffic proxied, as this hides the IP addresses + slows the speed down.

HTTP to HTTPS by Cloudflare is only possible when requests pass through Cloudflare, which isn’t the case anymore once you disable proxying.

Alternatively you can configure your own webserver to redirect HTTP traffic to HTTPS

2 Likes

Yea the problem is that I’m not using Apache or Nginx or anything like that, I’m using a really simple program named ‘Miniserve’, basically just a simple download server so I don’t know how to do that, I’ve searched standalone servers for that, but I’ve not found any, with standalone servers I mean like a .exe that uses port 80 and HTTP and all it does is redirect to HTTPS 443

You could move your program to another port and then deploy a simple webserver on it such as Caddy or Nginx that then acts as reverse proxy that handles both SSL and HTTPS redirections.

Any help on how to do that xd?

If you choose Nginx, you could use an simple online tool like NGINXConfig | DigitalOcean to create the config for it, which is usually the most complex part.
(I recommend choose as preset Node.js and then make sure to set the Reverse proxy settings right so it points at your Miniserve instance)

For the rest of the process like installing Nginx and such there are plenty of resources online that can be easily found via Google that should help you get up and running quickly :slightly_smiling_face:

Nah I’m not paying for Nginx, how to do it with Caddy?

Nginx is free to use and open-source

1 Like

Is the Nginx website u mean Ngix.com or Ngix.org?

A HTTP → HTTPS redirect is nothing more than listening for http:// on port 80 and returning a 301 status code with a Location header that contains the same URL they requested, but with https:// instead of http://

NGINX does have a paid NGINX Plus option but that’s not required - NGINX as-is is a fully open source project.

https://nginx.org/

1 Like

Yea but I got no idea how to do that man. I guess I’ll google it and i’ll hit you up if I find anything.

Got it working with NGINX for Windows.

By going to ...\nginx\conf\nginx.conf\ and adding/replacing these lines:

        server {
        listen       80;
        server_name  localhost;
	    return 301 https://$host$request_uri;

Basically server listens to port 80 on any connection, then returns the HTTPS version of that same input.