Gin: url.String() missing host

Created on 23 Mar 2017  路  2Comments  路  Source: gin-gonic/gin

hi,
not sure if this is a isolated issue, but i am trying to use context.Request.Url.String() to build pagination links. using the golang net/url i can build the links perfectly. but when i try to grab the url from context.Request.Url.String all i get back is the path, the entire host (http://www.mysite.com) is missing, even the URL.HostName() is empty. im not sure why gin is not showing this when golang's url package returns the full url in .String().

is there another way to get the complete URL from gin or do i need to rebuild it.
Thanks for the help

Most helpful comment

Maybe the location middleware helps you: https://github.com/gin-contrib/location

All 2 comments

turns out this is a issue with http.Request on local testing or proxy connection

Maybe the location middleware helps you: https://github.com/gin-contrib/location

Was this page helpful?
0 / 5 - 0 ratings