Rob--W / cors-anywhere

CORS Anywhere is a NodeJS reverse proxy which adds CORS headers to the proxied request.
MIT License
8.61k stars 6.02k forks source link

Allow cookies behind flag #56

Open si13b opened 7 years ago

si13b commented 7 years ago

Hi!

Thanks for this great little tool you've built. It's been great for us to use as part of a development server.

One little nit for us is the omission of the set-cookie header, because we depend on this for authentication. I understand that you've disallowed this to avoid security issues in production, but since we're using it in a development server we would like to allow it.

Is it possible you could add an option to allow cookies, perhaps hidden behind an obscure flag (e.g. dangerouslyAllowCookies)?

Rob--W commented 7 years ago

to avoid security issues in production, since we're using it in a development server we would like to allow it.

This line of thinking is dangerous ;)

Adding such a blanket flag is not secure unless it is guaranteed that the CORS server only proxies responses for a single origin.

If you do really want an option to allow cookies, please submit a pull request that does the following:

jeetgit commented 7 years ago

Hi,

Thank you for this great tool. I just need little more help from you. Need to include the cookie in the CORS request. I tried adding with credential="true" command in my request but with that cookie is not going through the cors request. Is there any way to make it possible?

Thanks in advance

Rob--W commented 7 years ago

Need to include the cookie in the CORS request. I tried adding with credential="true" command in my request but with that cookie is not going through the cors request. Is there any way to make it possible?

As an API user (from the client side)? No. As the host of CORS Anywhere? Only if you modify the server. I described in an earlier comment how this can be implemented.

jeetgit commented 7 years ago

Thanks for the fast reply. Yes, I hosted an instance of CORS Anywhere. Looking for the place where to change and what to change in the files (in the CORS Anywhere files) to send the cookies in the request.

Rob--W commented 7 years ago

@jeetgit See https://github.com/Rob--W/cors-anywhere/issues/56#issuecomment-267905416 to see what to change, and where to change it.