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

How can I use this with express-proxy? #112

Open
sunshineo opened this issue Jun 22, 2015 · 1 comment
Open

How can I use this with express-proxy? #112

sunshineo opened this issue Jun 22, 2015 · 1 comment

Comments

@sunshineo
Copy link

Hello,

I'm using express-proxy to proxy a form post to s3.
I want to add a field to the form. (The signed signature).

But I do not have a full node request. What I have is the buffer containing the multipart.

app.use('/proxy/s3', proxy('https://' + config.s3Bucket + '.s3.amazonaws.com', {
    decorateRequest: function(req) {
        console.log(req.bodyContent.toString());
        return req;
    }
}));

The req.bodyContent is the buffer that contains the multipart.

Is it possible for me to use this library or I have to manipulate the buffer manually.

Thank you very much!

==Edit==
I just read https://github.com/andrewrk/node-multiparty/blob/master/examples/s3.js
Maybe I should completely change my pattern. However, I am still interested in the original question. Can you manipulate multipart data before proxy it?

==Edit 2==
Just read detail of https://github.com/andrewrk/node-multiparty/blob/master/examples/s3.js#L45
Maybe this is not possible through proxy since the content length will not be correct.

@dougwilson
Copy link
Contributor

Hi @sunshineo it's currently not possible to (easily) parse the data if you have it outside of a Node.js HTTP request object, but certainly something that can get implemented :) !

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

2 participants