2024-02-13 11:00:48 +00:00
|
|
|
package handlers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
2024-02-13 21:39:34 +00:00
|
|
|
"net/http/httputil"
|
|
|
|
"net/url"
|
2024-02-13 11:00:48 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func (h *BaseHandler) Temporal(w http.ResponseWriter, r *http.Request, user *AuthenticatedUser) {
|
2024-02-13 21:39:34 +00:00
|
|
|
proxy := httputil.NewSingleHostReverseProxy(&url.URL{
|
2024-02-15 17:43:35 +00:00
|
|
|
Host: h.config.Temporal.UIHost,
|
2024-02-13 21:39:34 +00:00
|
|
|
Scheme: "http",
|
|
|
|
})
|
|
|
|
|
|
|
|
// TODO: Maybe add a "navbar" in html to go back to Zdravko?
|
|
|
|
proxy.ModifyResponse = func(response *http.Response) error {
|
|
|
|
// Read and update the response here
|
|
|
|
|
|
|
|
// The response here is response from server (proxy B if this is at proxy A)
|
|
|
|
// It is a pointer, so can be modified to update in place
|
|
|
|
// It will not be called if Proxy B is unreachable
|
|
|
|
return nil
|
2024-02-13 11:00:48 +00:00
|
|
|
}
|
|
|
|
|
2024-02-13 21:39:34 +00:00
|
|
|
proxy.ServeHTTP(w, r)
|
2024-02-13 11:00:48 +00:00
|
|
|
}
|