mirror of
https://github.com/minio/minio.git
synced 2025-01-11 23:13:23 -05:00
Add missing healthcheck router for gateway (#5764)
This commit is contained in:
parent
38ce19badd
commit
30ab71c9d9
@ -171,41 +171,18 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
|
|||||||
|
|
||||||
router := mux.NewRouter().SkipClean(true)
|
router := mux.NewRouter().SkipClean(true)
|
||||||
|
|
||||||
|
// Add healthcheck router
|
||||||
|
registerHealthCheckRouter(router)
|
||||||
|
|
||||||
// Register web router when its enabled.
|
// Register web router when its enabled.
|
||||||
if globalIsBrowserEnabled {
|
if globalIsBrowserEnabled {
|
||||||
fatalIf(registerWebRouter(router), "Unable to configure web browser")
|
fatalIf(registerWebRouter(router), "Unable to configure web browser")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add API router.
|
||||||
registerAPIRouter(router)
|
registerAPIRouter(router)
|
||||||
|
|
||||||
var handlerFns = []HandlerFunc{
|
globalHTTPServer = miniohttp.NewServer([]string{gatewayAddr}, registerHandlers(router, globalHandlers...), globalTLSCertificate)
|
||||||
// Validate all the incoming paths.
|
|
||||||
setPathValidityHandler,
|
|
||||||
// Limits all requests size to a maximum fixed limit
|
|
||||||
setRequestSizeLimitHandler,
|
|
||||||
// Adds 'crossdomain.xml' policy handler to serve legacy flash clients.
|
|
||||||
setCrossDomainPolicy,
|
|
||||||
// Validates all incoming requests to have a valid date header.
|
|
||||||
// Redirect some pre-defined browser request paths to a static location prefix.
|
|
||||||
setBrowserRedirectHandler,
|
|
||||||
// Validates if incoming request is for restricted buckets.
|
|
||||||
setReservedBucketHandler,
|
|
||||||
// Adds cache control for all browser requests.
|
|
||||||
setBrowserCacheControlHandler,
|
|
||||||
// Validates all incoming requests to have a valid date header.
|
|
||||||
setTimeValidityHandler,
|
|
||||||
// CORS setting for all browser API requests.
|
|
||||||
setCorsHandler,
|
|
||||||
// Validates all incoming URL resources, for invalid/unsupported
|
|
||||||
// resources client receives a HTTP error.
|
|
||||||
setIgnoreResourcesHandler,
|
|
||||||
// Auth handler verifies incoming authorization headers and
|
|
||||||
// routes them accordingly. Client receives a HTTP error for
|
|
||||||
// invalid/unsupported signatures.
|
|
||||||
setAuthHandler,
|
|
||||||
// Add new handlers here.
|
|
||||||
}
|
|
||||||
|
|
||||||
globalHTTPServer = miniohttp.NewServer([]string{gatewayAddr}, registerHandlers(router, handlerFns...), globalTLSCertificate)
|
|
||||||
|
|
||||||
// Start server, automatically configures TLS if certs are available.
|
// Start server, automatically configures TLS if certs are available.
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -57,41 +57,8 @@ func registerDistXLRouters(mux *router.Router, endpoints EndpointList) error {
|
|||||||
return registerBrowserPeerRPCRouter(mux)
|
return registerBrowserPeerRPCRouter(mux)
|
||||||
}
|
}
|
||||||
|
|
||||||
// configureServer handler returns final handler for the http server.
|
|
||||||
func configureServerHandler(endpoints EndpointList) (http.Handler, error) {
|
|
||||||
// Initialize router. `SkipClean(true)` stops gorilla/mux from
|
|
||||||
// normalizing URL path minio/minio#3256
|
|
||||||
mux := router.NewRouter().SkipClean(true)
|
|
||||||
|
|
||||||
// Initialize distributed NS lock.
|
|
||||||
if globalIsDistXL {
|
|
||||||
registerDistXLRouters(mux, endpoints)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add Admin RPC router
|
|
||||||
err := registerAdminRPCRouter(mux)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add Admin router.
|
|
||||||
registerAdminRouter(mux)
|
|
||||||
|
|
||||||
// Add healthcheck router
|
|
||||||
registerHealthCheckRouter(mux)
|
|
||||||
|
|
||||||
// Register web router when its enabled.
|
|
||||||
if globalIsBrowserEnabled {
|
|
||||||
if err := registerWebRouter(mux); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add API router.
|
|
||||||
registerAPIRouter(mux)
|
|
||||||
|
|
||||||
// List of some generic handlers which are applied for all incoming requests.
|
// List of some generic handlers which are applied for all incoming requests.
|
||||||
var handlerFns = []HandlerFunc{
|
var globalHandlers = []HandlerFunc{
|
||||||
// Ratelimit the incoming requests using a token bucket algorithm
|
// Ratelimit the incoming requests using a token bucket algorithm
|
||||||
setRateLimitHandler,
|
setRateLimitHandler,
|
||||||
// Validate all the incoming paths.
|
// Validate all the incoming paths.
|
||||||
@ -127,6 +94,39 @@ func configureServerHandler(endpoints EndpointList) (http.Handler, error) {
|
|||||||
// Add new handlers here.
|
// Add new handlers here.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register rest of the handlers.
|
// configureServer handler returns final handler for the http server.
|
||||||
return registerHandlers(mux, handlerFns...), nil
|
func configureServerHandler(endpoints EndpointList) (http.Handler, error) {
|
||||||
|
// Initialize router. `SkipClean(true)` stops gorilla/mux from
|
||||||
|
// normalizing URL path minio/minio#3256
|
||||||
|
mux := router.NewRouter().SkipClean(true)
|
||||||
|
|
||||||
|
// Initialize distributed NS lock.
|
||||||
|
if globalIsDistXL {
|
||||||
|
registerDistXLRouters(mux, endpoints)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add Admin RPC router
|
||||||
|
err := registerAdminRPCRouter(mux)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add Admin router.
|
||||||
|
registerAdminRouter(mux)
|
||||||
|
|
||||||
|
// Add healthcheck router
|
||||||
|
registerHealthCheckRouter(mux)
|
||||||
|
|
||||||
|
// Register web router when its enabled.
|
||||||
|
if globalIsBrowserEnabled {
|
||||||
|
if err := registerWebRouter(mux); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add API router.
|
||||||
|
registerAPIRouter(mux)
|
||||||
|
|
||||||
|
// Register rest of the handlers.
|
||||||
|
return registerHandlers(mux, globalHandlers...), nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user