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

POST request non proxyed #42

Open
giulianoz opened this issue Sep 2, 2015 · 5 comments
Open

POST request non proxyed #42

giulianoz opened this issue Sep 2, 2015 · 5 comments

Comments

@giulianoz
Copy link

Hi,
it seems that POST requests are not proxyed correctly as I see no requests arriving on destination server. The same request works fine from chrome/postman to the destination proxy. Also get requests works fine

BTW I've added this to handle the form data:
var body=req.body;
if (body) {
opts.form=body
}
before

var myReq = request(opts, function (myRes) {

my opts variable contains the following:
{ protocol: 'http:',
slashes: true,
auth: null,
host: '127.0.0.1:4000',
port: '4000',
hostname: '127.0.0.1',
hash: null,
search: null,
query: null,
pathname: '/admin',
path: '/admin/test',
href: 'http://127.0.0.1:4000/admin',
method: 'POST',
headers:
{ connection: 'keep-alive',
'content-length': '263',
'cache-control': 'no-cache',
origin: 'chrome-extension://fdmmgilgnpjigdojojpjoooidkmcomcm',
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.78 Safari/537.36',
'content-type': 'application/x-www-form-urlencoded',
accept: '/',
'accept-encoding': 'gzip, deflate',
'accept-language': 'it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4',
cookie: ...' },
form:
{ key1: 'value1' } }

do you have any idea about that ?

thanks

giuliano

@towry
Copy link

towry commented Oct 27, 2015

it seems that PUT method not work too.

@dijs
Copy link

dijs commented Oct 29, 2015

👍

1 similar comment
@broveloper
Copy link

👍

@fabianfett
Copy link

👍 I experience the same problems. Is any work going on this issue?

@fabianfett
Copy link

Fixed the problem (at least for me):

The issue was that I had a body parser consuming the req stream before the proxy-middleware could consume the req stream. Moving the proxy middleware before the body parser fixed the problem.

Though the question remains, if it would be a feature to at least close the connection to the host with an error (right now the response times out).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants