Proxy auth possible?

Hi, I am trying to proxy requests to unRAID web interface. It requires HTTP basic auth. I have tried the following but it does not work:

proxy / http://root:password@10.0.1.0 {
    transparent
    insecure_skip_verify
}

Caddy does not support specifying credentials in the URL of the upstream. You could try passing the Authorization header upstream, as follows:

proxy / http://10.0.1.0 {
    transparent
    insecure_skip_verify
    header_upstream Authorization Basic [BASE64_CREDENTIALS]
}

Where [BASE64_CREDENTIALS] is the base64 encoding of username:password, which can be obtained using this CyberChef recipe (or any other base64 encoder).

2018/05/27 16:28:44 /caddy/Caddyfile:32 - Error during parsing: unknown property 'cm9vdDpCb2VAAAAAAAAAAAA=='

I have tried both:

header_upstream Authorization Basic [cm9vdDpCb2VAAAAAAAAAAAA==]
header_upstream Authorization Basic cm9vdDpCb2VAAAAAAAAAAAA==

I think you need to use quotes around the argument, e.g.

header_upstream Authorization "Basic cm9vdDpCb2VAAAAAAAAAAAA=="
2 Likes

That worked, thanks!

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