The goal is to replace the hardcoded “store4” subdomain in the path with a dynamic alternative that can be determined at runtime.
I use Caddy as a proxy server locally to test a frontend application that requires HTTPS, subdomains, and HTTP-only cookies for proper browser functionality.
As a frontend engineer, I do not have sufficient knowledge about Caddy to accomplish the task.
I updated caddy to latest version. v2.6.4.
Code in screenshot works correctly.
2023/04/14 07:04:57.707 INFO using adjacent Caddyfile
Error: adapting config using caddyfile: parsing caddyfile tokens for 'reverse_proxy': Caddyfile:2 - Error during parsing: due to parsing difficulties, placeholders are not allowed when an upstream address contains a scheme
Using https:// is a shortcut for transport http with the tls option enabled. The scheme is only parsed at Caddyfile adapt time, so if there’s anything dynamic in the upstream address (i.e. replaced at runtime), that shortcut can’t be used.