In app router, server component, how can I get the current url (similar of window.location) #63587
-
Im using App router. GPT offered me to try |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
For more, here |
Beta Was this translation helpful? Give feedback.
-
It is not a rest api handler, so I don't have a request. |
Beta Was this translation helpful? Give feedback.
-
You can get it from headers |
Beta Was this translation helpful? Give feedback.
request.nextUrl.pathname;
For more, here