Proxy auth possible?


(Maciej świć) #1

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
}

(comp500) #2

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).


(Maciej świć) #3
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==

(comp500) #4

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

header_upstream Authorization "Basic cm9vdDpCb2VAAAAAAAAAAAA=="

(Maciej świć) #5

That worked, thanks!


(system) #6

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