Skip to content

Commit

Permalink
Merge pull request #1321 from SUSE/add-pp-healthcheck
Browse files Browse the repository at this point in the history
Portal proxy healthcheck
  • Loading branch information
nwmac authored Oct 24, 2017
2 parents 654b9d3 + ea1ba63 commit cc9a6c0
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions components/app-core/backend/setup_console.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,22 +234,31 @@ func (p *portalProxy) SetupMiddleware(setupMiddleware *setupMiddleware) echo.Mid

setupRequestRegex := "/v1/setup$"
setupUpdateRequestRegex := "/v1/setup/update$"
versionRequestRegex := "/v1/version$"
backendRequestRegex := "/v1/"

if inCFMode {
setupRequestRegex = fmt.Sprintf("^/pp%s", setupRequestRegex)
setupUpdateRequestRegex = fmt.Sprintf("^/pp%s", setupUpdateRequestRegex)
versionRequestRegex = fmt.Sprintf("^/pp%s", versionRequestRegex)
backendRequestRegex = fmt.Sprintf("^/pp%s", backendRequestRegex)
}

isSetupRequest, _ = regexp.MatchString(setupRequestRegex, requestURLPath)
if !isSetupRequest {
isSetupRequest, _ = regexp.MatchString("/v1/setup/update$", requestURLPath)
isSetupRequest, _ = regexp.MatchString(setupUpdateRequestRegex, requestURLPath)
}
if isSetupRequest {
return h(c)
}

isVersionRequest, _ := regexp.MatchString(versionRequestRegex, requestURLPath)

if isVersionRequest {
return h(c)
}
// Request is not a setup request, refuse backend requests and allow all others
isBackendRequest, _ := regexp.MatchString("/v1/", requestURLPath)
isBackendRequest, _ := regexp.MatchString(backendRequestRegex, requestURLPath)

if !isBackendRequest {
return h(c)
Expand Down

0 comments on commit cc9a6c0

Please sign in to comment.