You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not sure if this is cors issue or in general express issue however, there was a disscussion about that, so I decided to post my solution.
I was running into problems with getting req.headers.origin from "GET" method while using node.js with "express" router. However, using other methods, like POST req.headers.origin was working as expected.
In the discussion (https://github.com/expressjs/cors/issues/71) mentioned, was a solution to replace missing origin link with host:
req.headers.origin = req.headers.origin || req.headers.host;
However, I realised that referer always includes a full host link. Here is my solution that eventually replaces origin with another link scrambled from refefer.
What this does is scramble link from referer if original headers.origin is undefined and replaces correct link to headers.origin.
Hope this helps anyone who still has issues with this problem.
The text was updated successfully, but these errors were encountered:
I am not sure if this is cors issue or in general express issue however, there was a disscussion about that, so I decided to post my solution.
I was running into problems with getting req.headers.origin from "GET" method while using node.js with "express" router. However, using other methods, like POST req.headers.origin was working as expected.
In the discussion (https://github.com/expressjs/cors/issues/71) mentioned, was a solution to replace missing origin link with host:
req.headers.origin = req.headers.origin || req.headers.host;
However, I realised that referer always includes a full host link. Here is my solution that eventually replaces origin with another link scrambled from refefer.
What this does is scramble link from referer if original headers.origin is undefined and replaces correct link to headers.origin.
Hope this helps anyone who still has issues with this problem.
The text was updated successfully, but these errors were encountered: