replace-response
replace-response copied to clipboard
How to replace the content in websock
My caddyfile
a.com {
import log
reverse_proxy b.com {
header_up Accept-Encoding identity
header_up Host {upstream_hostport}
header_up X-Forwarded-Host {host}
}
replace {
foo bar
}
}
It didn't work
I think that's currently unsupported. I don't think it's possible either, unfortunately, without changes to the reverse_proxy module. Once the HTTP protocol upgrade to Websockets is performed, it becomes a direct bidirectional buffer copy with no opportunity to intercept the messages.
Hmm, yeah, I have no idea how to do this. Would require some clever, careful design work to allow other plugins to intercept the hijacked conn in the reverse proxy and inspect all the bytes flowing through as a stream.