-
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
Add support for removing the 'secure' attribute on proxied cookies #1165
Comments
This allows cookies proxied from HTTPS sites to be used by a non-HTTPS localhost development environment. Fixes http-party#1165.
We got the same issue, and adding "--https" as an option of the npm start as solve the problem, as we now work on https://localhost. |
Yeah that is one option, but having to walk the user (who can be a external contributor to the project) through accepting the self-signed certificate in their browser is an extra barrier to entry. Also it doesn't help tools like curl which will use a different CA certificate store to the browser. |
+1 |
This allows cookies proxied from HTTPS sites to be used by a non-HTTPS localhost development environment. Fixes http-party#1165.
I tried this, but it didn't work:
The console shows the cookie secure flag has been removed, but the browser still receives the cookie with the secure flag set. |
@futurechan You should assign modified onProxyRes: (proxyRes, req, res) => {
const sc = proxyRes.headers['set-cookie'];
if (Array.isArray(sc)) {
proxyRes.headers['set-cookie'] = sc.map(sc => {
return sc.split(';')
.filter(v => v.trim().toLowerCase() !== 'secure')
.join('; ')
});
}
}, |
@sharkovich awesome! |
For me, I'm using angular CLI with the proxy options, so the config is a JSON file in the project, providing function is not doable for me. |
@almothafar Try use
|
Our use case:
http://localhost:5000/api/*
tohttps://prod-app.com/api/*
.secure
cookie attribute.If there was an option to strip the
secure
attribute from the proxied cookie, we could use the workflow above.Example response:
The text was updated successfully, but these errors were encountered: