Set coordinator server address to :http for cloudretro

This commit is contained in:
Sergey Stepanov 2021-08-26 14:39:17 +03:00
parent db8bc62958
commit 904b0ae1bb
No known key found for this signature in database
GPG key ID: A56B4929BAA8556B
2 changed files with 8 additions and 8 deletions

View file

@ -1,3 +1,4 @@
CLOUD_GAME_COORDINATOR_SERVER_ADDRESS=
CLOUD_GAME_COORDINATOR_SERVER_HTTPS=true
CLOUD_GAME_COORDINATOR_SERVER_TLS_DOMAIN=cloudretro.io
CLOUD_GAME_ENVIRONMENT=prod

View file

@ -117,15 +117,15 @@ func (s *Server) GetProtocol() string {
}
func (s *Server) redirection() (*Server, error) {
address := s.Addr
if s.opts.HttpsDomain != "" {
address = s.opts.HttpsDomain
}
addr := buildAddress(address, s.opts.Zone, *s.listener)
srv, err := NewServer(s.opts.HttpsRedirectAddress, func(serv *Server) http.Handler {
h := http.NewServeMux()
address := s.Addr
if s.opts.HttpsDomain != "" {
address = s.opts.HttpsDomain
}
addr := buildAddress(address, s.opts.Zone, *s.listener)
h.Handle("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
httpsURL := url.URL{Scheme: "https", Host: addr, Path: r.URL.Path, RawQuery: r.URL.RawQuery}
rdr := httpsURL.String()
@ -137,9 +137,8 @@ func (s *Server) redirection() (*Server, error) {
if serv.autoCert != nil {
return serv.autoCert.HTTPHandler(h)
}
return h
})
log.Printf("Starting HTTP->HTTPS redirection server on %s", srv.Addr)
log.Printf("Starting HTTP->HTTPS redirection server on %s", addr)
return srv, err
}