{"timestamp": "2026-07-10T22:15:53.261917", "data": {"url": "https://caddy.community/t/what-is-a-correct-way-to-serve-multiple-server-ips-and-several-dns-records-for-one-application/13355", "title": "What is a correct way to serve multiple server ip's and several DNS records for one application? - Help - Caddy Community", "content": "Artem_F (Artem F) August 18, 2021, 11:08am 1 Hi, guys. Got question about .json config. My goal is to have one caddy to serve two dns records and forward them to any of two ip addresses where my application is running. I\u2019m trying to use json config shown below, but seems it is not correct. Because when I power off 135.181.24.1 node I got 502 dial tcp 135.181.24.1:3000: i/o timeout in caddy logs. I was expected caddy to forward request to the second ip who is still alive. I\u2019m sure I\u2019m doing something wrong or miss something, please correct me, or push my thoughts in correct direction. 1. Caddy version ( caddy version ): custom docker images based on Caddy 2.4.1 with certmagic-s3 and format-encoder modules 2. How I run Caddy: a. System environment: Ubuntu 18.04.5 LTS b. Command: /usr/bin/docker run --rm --name='proxy' \\ --mount type=bind,source=/etc/caddy_config.json,destination=/caddy_config.json \\ --publish 80:80 \\ --publish 443:443 \\ artemius/caddy:2.4.1 caddy run --config /caddy_config.json c. Dockerfile: FROM caddy:2.4.1-builder AS builder RUN xcaddy build --output ./caddy \\ --with github.com/ss098/certmagic-s3 \\ --with github.com/caddyserver/format-encoder FROM caddy:2.4.1 COPY --from=builder /usr/bin/caddy /usr/bin/caddy d. My current \u2018apps\u2019 part of JSON config: { \"apps\": { \"tls\": { \"certificates\": { \"automate\": [ \"dev-art.domain.com\", \"dev-art-2.domain.com\" ] } }, \"http\": { \"servers\": { \"dev-art\": { \"listen\": [ \":443\" ], \"routes\": [ { \"match\": [ { \"host\": [ \"dev-art.domain.com\", \"dev-art-2.domain.com\" ] } ], \"handle\": [ { \"handler\": \"reverse_proxy\", \"upstreams\": [ { \"dial\": \"135.181.24.1:3000\" }, { \"dial\": \"135.181.24.2:3000\" } ] } ] } ] } } } } } Sorry, because of NDA, main domain was changed to domain.com , it was containing company name. Other parts/structure as it is Artem_F (Artem F) August 18, 2021, 11:08am 1 Hi, guys. Got question about .json config. My goal is to have one caddy to serve two dns records and forward them to any of two ip addresses where my application is running. I\u2019m trying to use json config shown below, but seems it is not correct. Because when I power off 135.181.24.1 node I got 502 dial tcp 135.181.24.1:3000: i/o timeout in caddy logs. I was expected caddy to forward request to the second ip who is still alive. I\u2019m sure I\u2019m doing something wrong or miss something, please correct me, or push my thoughts in correct direction. 1. Caddy version ( caddy version ): custom docker images based on Caddy 2.4.1 with certmagic-s3 and format-encoder modules 2. How I run Caddy: a. System environment: Ubuntu 18.04.5 LTS b. Command: /usr/bin/docker run --rm --name='proxy' \\ --mount type=bind,source=/etc/caddy_config.json,destination=/caddy_config.json \\ --publish 80:80 \\ --publish 443:443 \\ artemius/caddy:2.4.1 caddy run --config /caddy_config.json c. Dockerfile: FROM caddy:2.4.1-builder AS builder RUN xcaddy build --output ./caddy \\ --with github.com/ss098/certmagic-s3 \\ --with github.com/caddyserver/format-encoder FROM caddy:2.4.1 COPY --from=builder /usr/bin/caddy /usr/bin/caddy d. My current \u2018apps\u2019 part of JSON config: { \"apps\": { \"tls\": { \"certificates\": { \"automate\": [ \"dev-art.domain.com\", \"dev-art-2.domain.com\" ] } }, \"http\": { \"servers\": { \"dev-art\": { \"listen\": [ \":443\" ], \"routes\": [ { \"match\": [ { \"host\": [ \"dev-art.domain.com\", \"dev-art-2.domain.com\" ] } ], \"handle\": [ { \"handler\": \"reverse_proxy\", \"upstreams\": [ { \"dial\": \"135.181.24.1:3000\" }, { \"dial\": \"135.181.24.2:3000\" } ] } ] } ] } } } } } Sorry, because of NDA, main domain was changed to domain.com , it was containing company name. Other parts/structure as it is", "lists": [["Home", "Categories", "Guidelines", "Terms of Service"]], "tables": [], "code_blocks": ["135.181.24.1", "dial tcp 135.181.24.1:3000: i/o timeout", "caddy version", "2.4.1", "certmagic-s3", "format-encoder", "/usr/bin/docker run --rm --name='proxy' \\\n--mount type=bind,source=/etc/caddy_config.json,destination=/caddy_config.json \\\n--publish 80:80 \\\n--publish 443:443 \\\nartemius/caddy:2.4.1 caddy run --config /caddy_config.json", "/usr/bin/docker run --rm --name='proxy' \\\n--mount type=bind,source=/etc/caddy_config.json,destination=/caddy_config.json \\\n--publish 80:80 \\\n--publish 443:443 \\\nartemius/caddy:2.4.1 caddy run --config /caddy_config.json", "FROM caddy:2.4.1-builder AS builder\nRUN xcaddy build --output ./caddy \\\n    --with github.com/ss098/certmagic-s3 \\\n    --with github.com/caddyserver/format-encoder\n\nFROM caddy:2.4.1\nCOPY --from=builder /usr/bin/caddy /usr/bin/caddy", "FROM caddy:2.4.1-builder AS builder\nRUN xcaddy build --output ./caddy \\\n    --with github.com/ss098/certmagic-s3 \\\n    --with github.com/caddyserver/format-encoder\n\nFROM caddy:2.4.1\nCOPY --from=builder /usr/bin/caddy /usr/bin/caddy", "{\n  \"apps\": {\n    \"tls\": {\n      \"certificates\": {\n        \"automate\": [ \"dev-art.domain.com\", \"dev-art-2.domain.com\" ]\n      }\n    },\n    \"http\": {\n      \"servers\": {\n        \"dev-art\": {\n          \"listen\": [ \":443\" ],\n          \"routes\": [\n            {\n              \"match\": [\n                { \"host\": [ \"dev-art.domain.com\", \"dev-art-2.domain.com\" ] }\n              ],\n              \"handle\": [\n                {\n                  \"handler\": \"reverse_proxy\",\n                  \"upstreams\": [\n                    { \"dial\": \"135.181.24.1:3000\" },\n                    { \"dial\": \"135.181.24.2:3000\" }\n                  ]\n                }\n              ]\n            }\n          ]\n        }\n      }\n    }\n  }\n}", "{\n  \"apps\": {\n    \"tls\": {\n      \"certificates\": {\n        \"automate\": [ \"dev-art.domain.com\", \"dev-art-2.domain.com\" ]\n      }\n    },\n    \"http\": {\n      \"servers\": {\n        \"dev-art\": {\n          \"listen\": [ \":443\" ],\n          \"routes\": [\n            {\n              \"match\": [\n                { \"host\": [ \"dev-art.domain.com\", \"dev-art-2.domain.com\" ] }\n              ],\n              \"handle\": [\n                {\n                  \"handler\": \"reverse_proxy\",\n                  \"upstreams\": [\n                    { \"dial\": \"135.181.24.1:3000\" },\n                    { \"dial\": \"135.181.24.2:3000\" }\n                  ]\n                }\n              ]\n            }\n          ]\n        }\n      }\n    }\n  }\n}", "domain.com", "FROM caddy:2.4.1-builder AS builder", "135.181.24.1", "dial tcp 135.181.24.1:3000: i/o timeout", "reverse_proxy 135.181.24.1:3000 135.181.24.2:3000 {\n\ttransport http {\n\t\tdial_timeout 3s\n\t}\n\tlb_try_duration 5s\n}", "reverse_proxy 135.181.24.1:3000 135.181.24.2:3000 {\n\ttransport http {\n\t\tdial_timeout 3s\n\t}\n\tlb_try_duration 5s\n}", "health_checks/active"], "meta_description": "Hi, guys. \nGot question about .json config. \nMy goal is to have one caddy to serve two dns records and forward them to any of two ip addresses where my application is running. \nI\u2019m trying to use json config shown below, \u2026", "meta_keywords": "", "og_image": "https://dqah5woojdp50.cloudfront.net/original/2X/9/9ff57336e95a9ba567e563d5e36d05c91df182df.png", "js_rendered": true, "js_message": "Page appears to be rendered by a JavaScript framework; content may be incomplete.", "success": true, "error": "", "truncated": false, "fetched_bytes": 223531, "total_bytes": null}}