Created by: kristofferaas
Hi
I had some issues with using the default proxy heuristics with my own websocket server. So I did some digging and as far as I can tell the proxyConfig.context
function returns undefined
if the accept
header is missing.
So I added a quick test prepareProxy.test.js
that uses proxyConfig.context
to filter a few mocked requests to check if they get proxied (returns true to proxy, false otherwise). And sure enough when testing path name /socket/proxy
without an accept
header it results in undefined
. I expect it to be true since since it should be proxied according to the default heuristics described in your documentation / comments.
So I changed proxyConfig.context
to ensure that both the method: GET
and Accept: text/html
check always returns a bool, and if they're false
only then calling mayProxy()
for a final check!
Passes the new tests and closes #5280