Help is wanted for proxy directive

Please advice on

header_upstream name value

header_upstream sets headers to be passed to the backend. The field name is name and the value is value. This option can be specified multiple times for multiple headers, and dynamic values can also be inserted using request placeholders. By default, existing header fields will be replaced, but you can add/merge field values by prefixing the field name with a plus sign (+). You can remove fields by prefixing the header name with a minus sign (-) and leaving the value blank.

access to zurmo platform results in the following error

The requested URL /zurmo/zurmo/app/index.php/zurmo/default/login was not found on this server.

Please note that, the subfolder somehow have been duplicated at the time of request /zurmo/zurmo/ as shown above
Can the above directive header_upstream used to remove /zurmo before sending request? Please hint on name and value entries.

Try without /zurmo :wink:

1 Like

header_upstream doesn’t really allow for manipulation of placeholders, which is what I think you’ve got in mind.

What’s your Caddyfile look like? My first hunch is that your prefix duplication could be fixed by tweaking your configuration, but I also think that you might be able to workaround it by using without:

  • without is a URL prefix to trim before proxying the request upstream. A request to /api/foo without /api, for example, will result in a proxy request to /foo.

edit: @matt beat me to it!

I did but it results in removing both i.e. request turns to

The requested URL …/app/app/app/app/app/app/app/app/app/app/app/app/app/app/app/app/…

my Caddyfile is {
tls /etc/caddy/MyDomain.CRT.PEM /etc/caddy/MyDomain.KEY.PEM
proxy / http://PrivateIP:PrivatePort/zurmo {

Try: {
    tls /etc/caddy/MyDomain.CRT.PEM /etc/caddy/MyDomain.KEY.PEM
    proxy / PrivateIP:PrivatePort {

The /zurmo on the end of your proxy to is causing requests for /zurmo/app/index.php/zurmo/default/login to be proxied, fully, to http://PrivateIP:PrivatePort/zurmo/zurmo/app/index.php/zurmo/default/login.

Also, http:// is implied for the proxy, so you can shorten that too.

Optionally, if you want to only proxy requests that begin with /zurmo, you can alter the base from path which would look like proxy /zurmo PrivateIP:PrivatePort ...