Possible to use directory as proxy parameter

Hello. I am trying to move some sites from Nginx to Caddy for a testing server and I am struggling with the following statement in nginx.

location ~ ^/([a-z0-9-]+)/(.+)$ {
    proxy_set_header Host $1.testing.env;
    expires max;

I started with something like this but I am unsure as to how to continue

proxy /  {
        header_upstream Host notsure.testing.env

This issue seems related on Github but I am hoping I can solve this with rewrites https://github.com/mholt/caddy/issues/1539

Hmm. It is possible to use a rewrite to set the {rewrite_uri} placeholder and effectively extract one result via regex, but I don’t think it’s possible to use that method for two separate dynamic elements.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.