1. The problem I’m having:
I have a rather complex setup. But I have an app that is accessible via:
https://myapp.company.com/ and then I use caddy-security to enforce OIDC if this URL is hit:
https://myapp.company.com/sso/
It works perfectly fine, everything works as expected. However if I put another caddy proxy in front of this, everything using GET still works, but if I try to POST it fails. Again, the website proxies fine, the GET works fine, but if I try to POST it fails.
http:// {
@authEmpty not header_regexp X-Token-User-Email ^(.*)
@authSet header_regexp X-Token-User-Email ^(.*)
# Bind to the zrok share
bind {{ .ZrokBindAddress }}
#If user has not authenticated, then force them through the sso.
redir @authEmpty /sso{uri}
route /* {
reverse_proxy @authSet localhost:631 {
header_up Host localhost:631
header_up X-Real-IP {http.request.header.x-forwarded-for}
}
}
}
2. Error messages and/or full log output:
3. Caddy version:
4. How I installed and ran Caddy:
This part is a bit complex, as this tool is embeds caddy into it for this part.
a. System environment:
RHEL8 Server.
b. Command:
This is ran through ZROK, so I am not quite sure what it is doing internally.
d. My complete Caddy config:
http:// {
@authEmpty not header_regexp X-Token-User-Email ^(.*)
@authSet header_regexp X-Token-User-Email ^(.*)
# Bind to the zrok share
bind {{ .ZrokBindAddress }}
#If user has not authenticated, then force them through the sso.
redir @authEmpty /sso{uri}
route /* {
reverse_proxy @authSet localhost:631 {
header_up Host localhost:631
header_up X-Real-IP {http.request.header.x-forwarded-for}
}
}
}
From the error in chrome, giving the 405 I tried to add some CORS stuff…
header {
Access-Control-Allow-Origin *
Access-Control-Allow-Credentials true
Access-Control-Allow-Methods *
Access-Control-Allow-Headers *
defer
}