如何将URL重定向到具有动态插入端口号的相同URL

For example:

Here the main intension is to hide the port number in the url. User should see the http://myproject.com/home/projects in the address bar on click of a button in webpage but it should dynamically redirect to the url http://myproject.com:portnumber/home/projects

I am using angular js and html for frontend and golang as backend.

What are the feasible ways to achieve above redirection either in golang or angular js?

you have *http.Request in your handle function and you can get your current host with *http.Request.URL.Host you get your domain and port that requested to your webserver.

func handler(r *http.Request, response http.Response) {
    println(r.URL.Host)
}