Closed elcferreira closed 2 years ago
Solution:
I'm using nuxt, and I tried to do it on
render > setHeaders
,
But i switch the logic to serverMiddleware
and it works.
😄
Hi @elcferreira sorry you never got a response to your question. I actually swear I remember replying to this question (I guess the same question but somewhere else lol). Anyway, you can access the request object from the response object using res.req
. The origin request header would thus be res.req.headers.origin
. I know you already have a solution, but just wanted to answer your original one for your reference and anyone else who crosses this issue.
Hey @dougwilson I tried it inside the nuxt.js (v2.15.8)
context, but I got undefined.
Hi @elcferreira hm.. I'm not sure exactly what nuxt.js is, as I haven't used it before. This particular module is an Express.js middleware. In Express.js, there is the res.req
: https://expressjs.com/en/4x/api.html#res.req
Hallo,
I'm having a problem to setup multiples domain to be
Access-Control-Allow-Origin
. I don't like to use*
because of security issues, so I was trying to apply this solution bellow:https://stackoverflow.com/questions/24897801/enable-access-control-allow-origin-for-multiple-domains-in-node-js
Is it possible to access the
origin
on the parameters returned onsetHeaders
?setHeaders(res, path, stat) {}
Thank you for all help. ❤️