Skip to content

Commit

Permalink
fix(engine): force host to update for reverse proxy (#4782)
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
  • Loading branch information
bnjjj authored and fsamin committed Nov 26, 2019
1 parent b8d81d0 commit 3b7408c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
10 changes: 0 additions & 10 deletions engine/ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,6 @@ func (s *Service) buildFromSource() error {
return fmt.Errorf("You must have the directory ../ui with the ui source code")
}

log.Info("ui> checking node version")
if output, err := s.execCommand("node --version"); err != nil {
return err
} else if !strings.HasPrefix(output, "v12.4.") {
return fmt.Errorf("You must have node version > v12.4.0 to build CDS UI. Your version: %s", output)
}

if _, err := s.execCommand("npm install --no-audit"); err != nil {
return err
}
Expand Down Expand Up @@ -312,9 +305,6 @@ func (s *Service) execCommand(command string) (string, error) {
if err := cmd.Run(); err != nil {
return "", sdk.WrapError(err, "could not run command")
}
if err := cmd.Wait(); err != nil {
return "", sdk.WrapError(err, "could not wait for command")
}
return output, nil
}

Expand Down
3 changes: 2 additions & 1 deletion engine/ui/ui_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ func (s *Service) getReverseProxy(path, urlRemote string) *httputil.ReverseProxy
} else {
req.Header.Add("X-Forwarded-Host", req.Host)
req.Header.Add("X-Origin-Host", origin.Host)
req.URL.Scheme = "http"
req.URL.Scheme = origin.Scheme
req.URL.Host = origin.Host
req.URL.Path = reqPath
req.Host = origin.Host
}
}
return &httputil.ReverseProxy{Director: director}
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82 h1:vsphBvatvfbhlb4PO1BYSr9dzugGxJ/SQHoNufZJq1w=
golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ=
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down

0 comments on commit 3b7408c

Please sign in to comment.