I'm trying to force HTTPS on remote connections and forward all traffic that is not from the 192.168.0
net to https://$host$request_uri but allow access on local connections.
In apache2 I had
Order allow,deny
Allow from 192.168.0
Allow from 127
Deny from all
in the HTTP hosts' config and had to manually change to HTTPS after getting a 403.
Ideally I'd like to add some code to the HTTP section instead of into every server since I setup a lot of subdomains.
I already read the answers from this question and know I can add
return 301 https://$host$request_uri;
But then all traffic is forwarded. I only want to forward REMOTE connections. Mainly to reduce overhead on local connections.