Skip to content

Commit bd70258

Browse files
committed
Remove secure attribute in cookies so browsers can set cookies when proxying to https
1 parent 26241ac commit bd70258

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class JsonCachingProxy {
5555
}
5656

5757
/**
58-
* Remove the domain portion of any cookies from the object
58+
* Remove the domain portion of any cookies from the object. Remove the secure attribute so we can set cookies to https targets
5959
* @param {Object} cookies - Express cookies array
6060
* @returns {Object[]} - Cookies with domain portion removed
6161
*/
@@ -64,10 +64,12 @@ class JsonCachingProxy {
6464
let cookieParts = c.split(';');
6565
let newCookieParts = [];
6666

67+
console.log(cookieParts);
68+
6769
cookieParts.forEach(c => {
68-
if (c.indexOf('domain') === -1) {
70+
if (c.indexOf('domain') === -1 && c.indexOf('secure') === -1) {
6971
newCookieParts.push(c);
70-
}
72+
}
7173
});
7274

7375
return newCookieParts.join(';');

0 commit comments

Comments
 (0)