I'm using Caddy as a reverse proxy, feeding a web app on CherryPy. Caddy is handling basic-auth, and I would like to pass the username to the CherryPy app.
I've modified my Caddyfile like this:
my.example.com {
redir /data_tools /data_tools/
handle_path /data_tools/* {
import basic-auth
reverse_proxy data_tools:1234 {
header_down +X-WEBAUTH-USER={http.auth.user.id}
}
}
}
When I go to my.example.com/data_tools/ I see my header populated correctly. If I go to my.example.com/data_tools/index.html, the header is there, but it's empty.
I've tried to intercept the headers with different hooks in CherryPy, but my header doesn't show up there at all.
def show_headers():
print("Request")
print(json.dumps(cherrypy.request.headers, indent="\t"))
print("Response")
print(json.dumps(cherrypy.response.headers, indent="\t"))
cherrypy.tools.get_user = cherrypy.Tool('on_start_resource', show_headers)
^^^ Shows expected headers, but not my custom one.
Any suggestions?