Update dev proxy
This commit is contained in:
@@ -4,4 +4,3 @@ dest = "/etc/caddy/Caddyfile"
|
||||
onlyexposed = false
|
||||
watch = true
|
||||
wait = "500ms:2s"
|
||||
notifycmd = "pkill -USR1 caddy"
|
||||
|
||||
@@ -4,46 +4,55 @@
|
||||
|
||||
{{ if not $hosts }}
|
||||
|
||||
127.0.0.1:2015
|
||||
127.0.0.1:80
|
||||
log stdout
|
||||
errors stderr
|
||||
|
||||
{{ else }}
|
||||
|
||||
{
|
||||
auto_https disable_redirects
|
||||
local_certs
|
||||
}
|
||||
{{ range $host, $containers := $hosts }}
|
||||
{{ $c := first $containers }}
|
||||
{{ $tlsOff := trim (index $c.Env "VIRTUAL_DISABLE_TLS") }}
|
||||
{{ $port := coalesce $c.Env.VIRTUAL_PORT "80" }}
|
||||
|
||||
http://{{ $host }}, https://{{ $host }} {
|
||||
tls self_signed
|
||||
tls internal
|
||||
|
||||
reverse_proxy * {
|
||||
header_up X-Real-IP {http.request.remote}
|
||||
header_up X-Forwarded-Port {http.request.port}
|
||||
header_up X-Forwarded-Proto {http.request.scheme}
|
||||
|
||||
flush_interval -1
|
||||
|
||||
proxy / {
|
||||
policy round_robin
|
||||
transparent
|
||||
websocket
|
||||
header_upstream Host {host}
|
||||
header_upstream X-Real-IP {remote}
|
||||
header_upstream X-Forwarded-For {remote}
|
||||
header_upstream X-Forwarded-Proto {scheme}
|
||||
{{ range $i, $container := $containers }}
|
||||
{{ $addrLen := len $container.Addresses }}
|
||||
{{ range $knownNetwork := $CurrentContainer.Networks }}
|
||||
{{ range $containerNetwork := $container.Networks }}
|
||||
{{ if (and (and (ne $containerNetwork.Name "ingress") (ne $containerNetwork.Name "bridge")) (or (eq $knownNetwork.Name $containerNetwork.Name) (eq $knownNetwork.Name "host"))) }}
|
||||
## Can be connected with "{{ $containerNetwork.Name }}" network
|
||||
upstream {{ $containerNetwork.IP }}:{{ $port }}
|
||||
to {{ $containerNetwork.IP }}:{{ $port }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
}
|
||||
|
||||
gzip {
|
||||
not /__webpack_hmr
|
||||
|
||||
@hmr {
|
||||
not {
|
||||
path /__webpack_hmr
|
||||
}
|
||||
}
|
||||
|
||||
encode @hmr gzip
|
||||
|
||||
log {
|
||||
output stdout
|
||||
}
|
||||
log stdout
|
||||
errors stderr
|
||||
}
|
||||
{{ end }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user