如果点击了外部网址,我们可以重定向到我们的应用程序吗

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.

  1. 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

  2. Update DNS records for example.com

  3. Inside your go-gin application set router to redirect to /login by HTTP referer or some other way.