gin
gin copied to clipboard
How get dynamic url from browser
I am public the frontend with golang+gin and have the load balancer (ingress). The ingress is redirect the request from the browser URL path from URL/web to /.
I would like set in my static files with path URL/web but when set using these parameters below the GIN does not unknow the /web only know / and not working
func GinStartApplication() {
mapUrlsTags()
mapUrlsRelease()
// SERVE STATICS
router.Use(static.Serve("/css", static.LocalFile("./html/assets/css", true)))
router.Use(static.Serve("/js", static.LocalFile("./html/assets/js", true)))
router.Use(static.Serve("/images", static.LocalFile("./html/assets/img", true)))
router.Use(static.Serve("/pdf", static.LocalFile("./html/assets/pdf", true)))
}
How can I set static files from the URL of the browser?
Versions: go version go1.17.4 linux/amd64 github.com/gin-gonic/gin v1.7.7
you should use /web
url everywhere.
router.Use(static.Serve("/web/css", static.LocalFile("./html/assets/css", true)))
router.Use(static.Serve("/web/js", static.LocalFile("./html/assets/js", true)))
router.Use(static.Serve("/web/images", static.LocalFile("./html/assets/img", true)))
router.Use(static.Serve("/web/pdf", static.LocalFile("./html/assets/pdf", true)))