How to get `req.nextUrl` in server actions | Next 14
Unanswered
Naeemgg posted this in #help-forum
NaeemggOP
I'm trying to do some logical stuff depending on from where the request is coming from, in route handlers its easy because of
req.nextUrl but I don't know how to get the same thing in server actions.5 Replies
NaeemggOP
I just want to know from which domain the request is coming from
like these
https://xyz.com/dash/blahttps://abc.org/bla/..like these
Is there anyway we can obtain this in server actions?
Asian black bear
afaik u can use headers() in server actions
NaeemggOP
Ummm could you please elaborate it a bit more
Asian black bear
if u need just domain, can get it from host header
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Host
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Host