I'm using the experimental appDir in Next.js 13, and want to get the URL path of the request. I need this info to set the searchparams before I do the redirection. I want to get the request path on the server side.
There is a question with similar to this. How to get current pathname in app directory with Next 13? However it concerns with getting pathname on the client side.
I have tried looking into the Layout option and it has props of only children and params. I will not be able to reconstruct the URL with that info. I would like to know where the request is coming from on the server side. How can I achieve this?