Skip to content

Commit

Permalink
health: Stop requiring x-forwarded-proto (#731)
Browse files Browse the repository at this point in the history
Closes #726
  • Loading branch information
arekkas authored Jan 3, 2018
1 parent 260aec8 commit b83541c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/ory/fosite"
foauth2 "github.com/ory/fosite/handler/oauth2"
"github.com/ory/fosite/token/hmac"
"github.com/ory/hydra/health"
"github.com/ory/hydra/metrics"
"github.com/ory/hydra/pkg"
"github.com/ory/hydra/warden/group"
Expand Down Expand Up @@ -155,7 +156,7 @@ func (c *Config) DoesRequestSatisfyTermination(r *http.Request) error {
return errors.New("TLS termination is not enabled")
}

if r.URL.Path == "/health" {
if r.URL.Path == health.HealthStatusPath {
return nil
}

Expand Down
9 changes: 7 additions & 2 deletions health/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ import (
"github.com/ory/hydra/metrics"
)

const (
HealthStatusPath = "/health/status"
HealthMetricsPath = "/health/metrics"
)

type Handler struct {
Metrics *metrics.MetricsManager
H *herodot.JSONWriter
Expand All @@ -43,8 +48,8 @@ func (h *Handler) PrefixResource(resource string) string {
}

func (h *Handler) SetRoutes(r *httprouter.Router) {
r.GET("/health/status", h.Health)
r.GET("/health/metrics", h.Statistics)
r.GET(HealthStatusPath, h.Health)
r.GET(HealthMetricsPath, h.Statistics)
}

// swagger:route GET /health/status health getInstanceStatus
Expand Down

0 comments on commit b83541c

Please sign in to comment.