summaryrefslogtreecommitdiff
path: root/caddytest/integration/caddyfile_adapt/reverse_proxy_upstream_placeholder.txt
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2021-03-03 12:12:31 -0500
committerGitHub <noreply@github.com>2021-03-03 10:12:31 -0700
commit51f35ba03f78e691d0e141b24ff19f82bfb34b67 (patch)
tree46ea4954e1453b030fd2c8bccf1adfb77739885a /caddytest/integration/caddyfile_adapt/reverse_proxy_upstream_placeholder.txt
parentad8d01cb66316cf04ea49ec277316d6f83b9abb6 (diff)
reverseproxy: Fix upstreams with placeholders with no port (#4046)
Diffstat (limited to 'caddytest/integration/caddyfile_adapt/reverse_proxy_upstream_placeholder.txt')
-rw-r--r--caddytest/integration/caddyfile_adapt/reverse_proxy_upstream_placeholder.txt102
1 files changed, 102 insertions, 0 deletions
diff --git a/caddytest/integration/caddyfile_adapt/reverse_proxy_upstream_placeholder.txt b/caddytest/integration/caddyfile_adapt/reverse_proxy_upstream_placeholder.txt
new file mode 100644
index 0000000..91c8f30
--- /dev/null
+++ b/caddytest/integration/caddyfile_adapt/reverse_proxy_upstream_placeholder.txt
@@ -0,0 +1,102 @@
+:8884 {
+ map {host} {upstream} {
+ foo.example.com 1.2.3.4
+ default 2.3.4.5
+ }
+
+ # Upstream placeholder with a port should retain the port
+ reverse_proxy {upstream}:80
+}
+
+:8885 {
+ map {host} {upstream} {
+ foo.example.com 1.2.3.4:8080
+ default 2.3.4.5:8080
+ }
+
+ # Upstream placeholder with no port should not have a port joined
+ reverse_proxy {upstream}
+}
+----------
+{
+ "apps": {
+ "http": {
+ "servers": {
+ "srv0": {
+ "listen": [
+ ":8884"
+ ],
+ "routes": [
+ {
+ "handle": [
+ {
+ "defaults": [
+ "2.3.4.5"
+ ],
+ "destinations": [
+ "{upstream}"
+ ],
+ "handler": "map",
+ "mappings": [
+ {
+ "input": "foo.example.com",
+ "outputs": [
+ "1.2.3.4"
+ ]
+ }
+ ],
+ "source": "{http.request.host}"
+ },
+ {
+ "handler": "reverse_proxy",
+ "upstreams": [
+ {
+ "dial": "{upstream}:80"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "srv1": {
+ "listen": [
+ ":8885"
+ ],
+ "routes": [
+ {
+ "handle": [
+ {
+ "defaults": [
+ "2.3.4.5:8080"
+ ],
+ "destinations": [
+ "{upstream}"
+ ],
+ "handler": "map",
+ "mappings": [
+ {
+ "input": "foo.example.com",
+ "outputs": [
+ "1.2.3.4:8080"
+ ]
+ }
+ ],
+ "source": "{http.request.host}"
+ },
+ {
+ "handler": "reverse_proxy",
+ "upstreams": [
+ {
+ "dial": "{upstream}"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ }
+ }
+ }
+}