fix: allow ports in wildcard url configuration (#11657)

* fix: allow ports in wildcard url configuration

This just forwards the port to the ui that generates urls.
Our existing parsing + regex already supported ports for
subdomain app requests.
This commit is contained in:
Steven Masley
2024-01-18 09:44:05 -06:00
committed by GitHub
parent 1f0e6ba6c6
commit 6bb1a34a37
12 changed files with 203 additions and 31 deletions
+1 -7
View File
@@ -3,7 +3,6 @@ package coderd
import (
"context"
"database/sql"
"fmt"
"net/http"
"net/url"
"strings"
@@ -32,13 +31,8 @@ import (
// @Router /applications/host [get]
// @Deprecated use api/v2/regions and see the primary proxy.
func (api *API) appHost(rw http.ResponseWriter, r *http.Request) {
host := api.AppHostname
if host != "" && api.AccessURL.Port() != "" {
host += fmt.Sprintf(":%s", api.AccessURL.Port())
}
httpapi.Write(r.Context(), rw, http.StatusOK, codersdk.AppHostResponse{
Host: host,
Host: appurl.SubdomainAppHost(api.AppHostname, api.AccessURL),
})
}