Skip to content
Discussion options

You must be logged in to vote

The best I can come up with at this time is: if server.getBaseUrl() does not exist, create it using the port info pulled from current server request headers either from the pages/_document.js static Document.getInitialProps' context.req arg or from the pages/api routes' req arg.

Hope there is a way to intercept all requests to pages/api routes in one place with a middleware call to streamline the process. Or perhaps, I am currently unaware of it. At the moment, I am using next-connect in all pages/api routes to attach the middleware that pulls the port info.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@steveswork
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by steveswork
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants