Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed proxyConfig.context to return a bool when headers.accept is undeclared. #8966

Closed
wants to merge 1 commit into from

Conversation

kristofferaas
Copy link

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

@facebook-github-bot
Copy link

Hi @kristofferaas!

Thank you for your pull request and welcome to our community.We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file.

In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@stale
Copy link

stale bot commented Jun 5, 2020

This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label Jun 5, 2020
@stale
Copy link

stale bot commented Jun 10, 2020

This pull request has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue. Thank you for your contribution!

@stale stale bot closed this Jun 10, 2020
@lock lock bot locked and limited conversation to collaborators Jun 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting "proxy" in package.json Fails for WebSockets
2 participants