From fde0681a93f052b7c8d79f6c8e16fa70b2acd886 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 8 Jun 2022 13:24:43 -0700 Subject: [PATCH] Server Side CORS Updates. --- client/src/utils/CleanAxios.js | 2 ++ server.js | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/utils/CleanAxios.js b/client/src/utils/CleanAxios.js index 19b71e969..0ddc62be6 100644 --- a/client/src/utils/CleanAxios.js +++ b/client/src/utils/CleanAxios.js @@ -6,6 +6,8 @@ if (process.env.NODE_ENV === "production") { process.env.REACT_APP_AXIOS_BASE_API_URL || "https://api.imex.online/"; } +axios.defaults.withCredentials = true; + export const axiosAuthInterceptorId = axios.interceptors.request.use( async (config) => { if (!config.headers.Authorization) { diff --git a/server.js b/server.js index 952d1cc67..d3b809531 100644 --- a/server.js +++ b/server.js @@ -36,6 +36,7 @@ const io = new Server(server, { "https://www.imex.online", ], methods: ["GET", "POST"], + credentials: true, }, }); exports.io = io; @@ -48,7 +49,7 @@ app.use(bodyParser.json({ limit: "50mb" })); app.use(bodyParser.urlencoded({ limit: "50mb", extended: true })); //app.use(enforce.HTTPS({ trustProtoHeader: true })); app.use( - cors() + cors({ credentials: true }) // cors({ // credentials: true, // origin: [