diff --git a/Dockerfile b/Dockerfile index 733e766..d715683 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ ENV REVERSE_PROXY "" ENV ON_DEMAND_TLS_ASK "" ENV ALLOWED_REMOTE_IPS_CONTROL_PLANE "" ENV ALLOWED_REMOTE_IPS_SERVICES "" -ENV ALLOWED_REMOTE_IPS_HTTP "255.255.255.255" +ENV ALLOWED_REMOTE_IPS_HTTP "" ENV HOST_UNAME Linux # replaced at runtime: diff --git a/etc/Caddyfile.ctmpl b/etc/Caddyfile.ctmpl index 2079a0c..b921c62 100644 --- a/etc/Caddyfile.ctmpl +++ b/etc/Caddyfile.ctmpl @@ -120,7 +120,8 @@ https://{{ $hosty }} { log } - {{- if $origin | regexReplaceAll "^https://" "" | regexMatch ":" }}{{- else }} + {{- if ne (env "ALLOWED_REMOTE_IPS_HTTP") "" }} + {{- if $origin | regexReplaceAll "^https://" "" | regexMatch ":" }}{{- else }} http://{{ $origin | regexReplaceAll "^https://" "" }} { @redir not remote_ip {{ env "ALLOWED_REMOTE_IPS_HTTP" }} redir @redir https://{host}{uri} permanent @@ -131,6 +132,7 @@ http://{{ $origin | regexReplaceAll "^https://" "" }} { } log } + {{- end -}} {{- end -}} {{- end -}} {{- end -}}