Reverse proxy with subfolder


I’m trying to set up a reverse proxy for application that uses angularjs as a front end (GitHub - theotherp/nzbhydra: Meta search for NZB indexers) on FreeBSD 11.0-release and using Caddy 0.9.5.

The app is set to use the subfolder /hydra and i have tested the following configuration works in nginx

location /hydra/ {
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

The equivalent i have for caddy is

proxy /hydra/ {
        header_upstream X-Forwarded-For {remote}

But this breaks the app with a load of errors

The stylesheet was not loaded because its   MIME type, “text/html”, is not “text/css”.  hydra
The stylesheet was not loaded because its MIME type, “text/html”, is not “text/css”.  hydra
SyntaxError: expected expression, got '<'[Learn More]  alllibs.js:1
SyntaxError: expected expression, got '<'[Learn More]  nzbhydra.js:1
ReferenceError: apiCheck is not defined[Learn More]  hydra:51:5

If i remove all references to the subfolder and proxy just using using the subdomain e.g
(url) rather than (url)/hydra/ then everything also works in caddy.

My presumption is that the app is not at fault as the configuration works with the subfolder in nginx and without the subfolder everything works in caddy am i missing something from the above caddy configuration ?


Hi @xeek, I also use Caddy to proxy to NZB Hydra.

This is the appropriate part of my Caddyfile:

proxy /hydra {

You may note the lack of the trailing /hydra subfolder on the upstream in my config. I also leave out the trailing slash, as NZB Hydra itself will rewrite to include it and it is better to be flexible.

The URL base setting absolutely must be set correctly (you mention it is configured, but I include this for the sake of completeness):



Many thanks that caddy config did the trick! I thought i had tried all the permutations but obviously not.


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