You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need to display the origin on our page. But we find that it is no way to get the protocol (http or https) on server side in getInitialProps.
Then we find next-absolute-url. But it can only deal with 'localhost'. If we add '127.0.0.1 www.aaa.com' into host file and we type 'http://www.aaa.com/' in browser, we get https returned by next-absolute-url.
So, is there a easy way to get the true protocol(origin) in getInitialProps (return exactly the same to location.protocol on client side)?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
We need to display the origin on our page. But we find that it is no way to get the protocol (http or https) on server side in
getInitialProps
.Then we find
next-absolute-url
. But it can only deal with 'localhost'. If we add '127.0.0.1 www.aaa.com' into host file and we type 'http://www.aaa.com/' in browser, we get https returned bynext-absolute-url
.So, is there a easy way to get the true protocol(origin) in
getInitialProps
(return exactly the same to location.protocol on client side)?Beta Was this translation helpful? Give feedback.
All reactions