On 1/8/21 5:29 PM, Gerry wrote:
Effectively, I would like to modify the proxied HTTP request in such a way that I can inject a Cookie: header. I do not want to set a cookie in the user's client.
As usual, after mulling over it for way too long before posting, I found the solution less than an hour after. Turns out one can modify the incoming Cookie: header value by setting r.headers_in["Coookie"] to the desired value, and mod_proxy will happily use it for its request. Sample code, should anyone need it:
function proxy_handler(r) if r.uri:match("^/local/websocket") then r.headers_in["Cookie"] = 'MyCookie=foobar' r.handler = "proxy-server" r.proxyreq = apache2.PROXYREQ_REVERSE r.filename = "proxy:wss://192.0.2.1/remote/websocket" return apache2.OK end return apache2.DECLINED end
Cheers, Gerry --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx