Redirecting HTTP to HTTPS for outbound traffic

Hello all. I am wanting to redirect any traffic designated for Port 80 (HTTP in general) to Port 443. I've looked at the NAT rules for OpenWRT but it's a bit confusing what I should set. Further clarification:

If one of the programs on my devices tries to make a connection to any server out on the WAN, but it is trying to connect to port 80 (HTTP), I want to mangle the outgoing packets to redirect them to port 443 on the remote server (HTTPS).

What rule should I create to do this?

That depends on what you actually want to accomplish.

Redirecting or forwarding one port to another is one thing, and easily done via fw4. This however won't encrypt/ decrypt between http and https though, it merely changes the (external) port, not the (unencrypted) traffic transmitted over it.

If you do want to translate between unencrypted http and encrypted https, you'd need something like a reverse proxy to handle this (if your internal service can't speak https itself).

Yes, it is still what I wish to do even though it would remain unencrypted. (A lot of applications, specifically games, don't encrypt their transmissions all the time, and they aren't running their data through port 80.)

For a reverse proxy, I imagine I'd have to use Nginx for that (which I is another rabbit hole for me to climb down into). For now, redirecting is what I am trying to accomplish.

1 Like

Thank you for your help, that sums it up.

To clarify, this is correct? FW4's GUI makes it look more confusing than it should be:

config redirect
        option name '80 to 443'
        option target 'DNAT'
        option src 'lan'
        option dest 'wan'
        option src_dport '80'
        option dest_port '443'
        option family 'ipv4'
1 Like

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