Help with redirecting http to https with pf.conf reddit / BSD ---------------------------------------------------------------------- mladokopele · 2021-07-21 17:21 Hello all, I started learning BSD vaguely and have an openbsd webserver. I added the below rule in an attempt to redirect http to https traffic however I didn't get the desired effect. pass in on egress proto tcp from any to PUBLIC_IP port 80 rdr-to PUBLIC_IP port 443 When I try to access my website through http it doesn't redirect to https but rather is prompting me to dowlonad a file.. Is the above rule incorrect? If not, am I missing an additional step outside of pf.conf to ensure http to https redirection works properly? Thanks! ---------------------------------------------------------------------- farceduse · 2021-07-21 17:53 This won't work because you're only changing the port at a Layer 4 level, whereas you're trying to solve a Layer 6/7 issue. You need to intercept this at the Layer 7 layer (HTTP) and redirect (Status code 301) to the HTTPS URI. Unless of course you're trying to do something like https://site.com:80/, but that seems unlikely. ---------------------------------------------------------------------- [deleted] · 2021-07-21 20:32 [removed] ---------------------------------------------------------------------- mladokopele · 2021-07-21 23:48 Hi, thanks for your help. Separating my server sections into 2 different entries one for 80 and 443 into my httpd.conf, solved the problem. For the 80 entry as you stated this has to be redirecting 301 code. Accessing my website via http now redirects to https ---------------------------------------------------------------------- farceduse · 2021-07-22 00:58 That’s great! I’m glad it worked for you. ---------------------------------------------------------------------- phobug · 2021-07-22 17:13 Happy cake day!