Add conditional default subdomain setting to proxy
If a domain has been declared for the host, the upstream file will proxy at a subdomain named for the stack it proxies to, otherwise it will do the same for the path.
This commit is contained in:
parent
03a0b0ce00
commit
daef2b7f13
2 changed files with 26 additions and 10 deletions
|
|
@ -5,4 +5,3 @@ docker_swarm_advertise_addr: eth1
|
||||||
caddy_use_debug: yes
|
caddy_use_debug: yes
|
||||||
caddy_use_https: no
|
caddy_use_https: no
|
||||||
caddy_tls_use_staging: yes
|
caddy_tls_use_staging: yes
|
||||||
caddy_create_test_file_server: yes
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,30 @@
|
||||||
{
|
{
|
||||||
"@id": "{{ stack.name }}_upstream",
|
"@id": "{{ stack.name }}_upstream",
|
||||||
"handle": [
|
{% if domain is not undefined and not none %}
|
||||||
{
|
"match": [
|
||||||
"handler": "reverse_proxy",
|
|
||||||
"upstreams": [
|
|
||||||
{
|
{
|
||||||
"dial": "{{ stack.name }}_app:80"
|
"host": [
|
||||||
|
"{{ stack.name }}.{{ domain }}"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
}
|
{% else %}
|
||||||
]
|
"match": [
|
||||||
|
{
|
||||||
|
"path": [
|
||||||
|
"/{{ stack.name }}*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
{% endif %}
|
||||||
|
"handle": [
|
||||||
|
{
|
||||||
|
"handler": "reverse_proxy",
|
||||||
|
"upstreams": [
|
||||||
|
{
|
||||||
|
"dial": "{{ stack.name }}_app:80"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue