-
Notifications
You must be signed in to change notification settings - Fork 2k
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
node-http-proxy XHR post call hanging #843
Comments
Same problem with reverse proxy and jQuery ajax post call: /home/whk/demo/node/node_modules/http-proxy/lib/http-proxy/index.js:119 |
I tried this solution. Content-Length is already correctly set in request object. In the above code, the request object is coming from the browser, so it should directly go to http-proxy and get the response. |
it can work but it's a bug. |
I would try and not parse the body when proxying a request. Errors are also not being handled so you cannot gracefully respond to the client when the remote server you are proxying to is down or something happens when communicating with said remote server. |
Crash in: POST /test/?id=42 HTTP/1.1 do=calendarioMes&datetime=2015-06-01+00%3A00%3A00&profesionalId=268188&user-token=xxx&type=json |
I was trying to use it for a specific endpoint instead of a middleware but that didn't work. it doesn't even throw an error, just says can't get/*** and fails. Am I doing something wrong or there's an issue with express compatibility? Here's my code for the reference:
|
body-parser middleware is causing the problem. If you remove it, then it will work. This is just a hack, we need to find a solution to this problem. |
Hey @prashantbaid! I tried what you suggested. Removed both the body-parser and cookie-parser. It still doesn't work. It still fails without any error. Any idea why? Here's the exact code that I'm using:
|
Got it to work. For others facing the same issue, the 'changeOrigin' option must be set to true. And @prashantbaid was right about the body-parser. On adding it, http-proxy doesn't work. |
Support for bodyparser.json and bodyparser.urlencoded. Fixes http-party#955 http-party#843 http-party#791
Create a simple express app and try to do proxy.
Proxy working fine when request is GET but it getting hang on post XHR call
Googled and got this solution #180
but now application not hanging. I am getting response 404 not found. and getting below error
The text was updated successfully, but these errors were encountered: