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

Related issues

rawoke083 picture rawoke083  路  3Comments

cxk280 picture cxk280  路  3Comments

ghost picture ghost  路  3Comments

mdnight picture mdnight  路  3Comments

ccaza picture ccaza  路  3Comments