The reverse proxy feature works only on port 443 (HTTPS)

Hi Folks,

I’m setting up reverse proxy on nethsecurity, but it only works on https, how can I redirect my users to the https port?

Thanks,

Hi @jfranco You’re right: on NethSecurity the reverse proxy listens only on HTTPS (port 443), not on HTTP (port 80).

To automatically redirect users from HTTP (80) to HTTPS (443), you can create a global redirect in nginx:

uci set nginx._cleartext=server

uci add_list nginx._cleartext.listen=‘80 default_server’

uci add_list nginx._cleartext.listen=‘[::]:80 default_server’

uci set nginx._cleartext.return=‘301 https://$host$request_uri’

uci set nginx._cleartext.server_name=‘_’

uci commit nginx

/etc/init.d/nginx reload

Then, open port 80 on the WAN side in the firewall rules so that HTTP connections can reach the firewall.

This setup keeps all real traffic on HTTPS while transparently redirecting any HTTP request to HTTPS.

Try this

3 Likes

Thank you @jgjimenezs

it works!!!

1 Like

It’s a pleasure, brother. I’m glad to be of help.

Good morning!!!

Now it creates a different problem:

  • When I need to request a new certificate, it doesn’t process letsencrypt :frowning:

I guess the redirection is causing the issue.

Thanks,