I am using go-gin and its html template rendering engine but this question is generic. My application has a login page at https://localhost:8080/login. I use a third-party url in my application which re-directs me to another url. (eg:https://example.com). How can I force redirect to https://localhost:8080/login
if https://example.com
is hit?
External URLs (links to a site from outside your server) can not be redirected to localhost.
You have to use your server IP instead of https://localhost:8080
or map example.com to your localhost. Mapping from your domain to your localhost
Update DNS records for example.com
Inside your go-gin application set router to redirect to /login by HTTP referer
or some other way.