Compare commits
2 Commits
v2023.4.21
...
v2023.4.21
Author | SHA1 | Date | |
---|---|---|---|
abc60b9ae3 | |||
f99b1ac6ac |
@ -73,12 +73,7 @@ func (h *Handler) serveAppURL(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
from := req.From
|
||||
if from == "" {
|
||||
host, _, err := net.SplitHostPort(r.RemoteAddr)
|
||||
if err != nil {
|
||||
logger.Warn(ctx, "could not split remote address", logger.E(errors.WithStack(err)))
|
||||
} else {
|
||||
from = host
|
||||
}
|
||||
from = retrieveRemoteAddr(r)
|
||||
}
|
||||
|
||||
url, err := h.repo.GetURL(ctx, appID, from)
|
||||
@ -110,3 +105,12 @@ func Mount(repository Repository) MountFunc {
|
||||
r.Post("/api/v1/apps/{appID}/url", handler.serveAppURL)
|
||||
}
|
||||
}
|
||||
|
||||
func retrieveRemoteAddr(r *http.Request) string {
|
||||
host, _, err := net.SplitHostPort(r.RemoteAddr)
|
||||
if err != nil {
|
||||
host = r.RemoteAddr
|
||||
}
|
||||
|
||||
return host
|
||||
}
|
||||
|
Reference in New Issue
Block a user