losing host header in wrangler

I have Caddy to proxy to wrangler for a worker. In my local I am struggling to get the sub domain. I know I can pass host wile launching wrangler but that wont scale for integration tests.

And when I add this in Caddy hoping it could be a decent workaround, I am shocked to see the following behavior:

request_header X-Original-Host customer3.mydomain.app
request_header X-Original-Host1 customer3.whatever
request_header X-Custom-Header customer3.mydomain.app

the second header is preserved but the first one it comes in as "mydomain.app". But surprisingly even the third one comes in as mydomain.app. It seems like a real bug to me where some code is doing a simple string parsing on domain matching irrespective of the header.

It's really blocking me to add logic based on subdomain and run the same code in production and local. Also my integration suite in local has to test this flow properly as I use subdomain to run some custom logic.
Was this page helpful?