Allowing proxying for secure cookies.

This commit is contained in:
Harrison Deng 2022-04-09 18:28:59 -05:00
parent 450fcfeb5a
commit 8e1ead37e6
4 changed files with 5 additions and 3 deletions

1
.gitignore vendored
View File

@ -165,3 +165,4 @@ dist
# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,node # End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,node
**/server/public/**

View File

@ -18,7 +18,7 @@
}, },
"scripts": { "scripts": {
"start": "NODE_ENV='development' REACT_APP_API_HOST='http://localhost:5000' react-scripts start", "start": "NODE_ENV='development' REACT_APP_API_HOST='http://localhost:5000' react-scripts start",
"build": "../scripts/build.py", "build": "python3 ../scripts/build.py",
"test": "react-scripts test", "test": "react-scripts test",
"eject": "react-scripts eject" "eject": "react-scripts eject"
}, },
@ -44,4 +44,4 @@
"eslint": "^8.12.0", "eslint": "^8.12.0",
"eslint-plugin-react": "^7.29.4" "eslint-plugin-react": "^7.29.4"
} }
} }

2
sports-matcher/scripts/build.py Normal file → Executable file
View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import os import os
import shutil import shutil

View File

@ -14,6 +14,7 @@ const sessionConf = {
}; };
if (process.env.NODE_ENV === "production") { if (process.env.NODE_ENV === "production") {
sessionConf.cookie.secure = true; sessionConf.cookie.secure = true;
sessionConf.proxy = true;
sessionConf.store = MongoStore.create({ mongoUrl: mongoURI, dbName: mongooseDbName }); sessionConf.store = MongoStore.create({ mongoUrl: mongoURI, dbName: mongooseDbName });
} }
export const userSession = session(sessionConf); export const userSession = session(sessionConf);