code: func New(ctx context.Context, next http.Handler, config config.Headers, name string) (http.Handler, error) {
  	// HeaderMiddleware -> SecureMiddleWare -> next
  	logger := middlewares.GetLogger(ctx, name, typeName)
  	logger.Debug("Creating middleware")
  
  	hasSecureHeaders := config.HasSecureHeadersDefined()
  	hasCustomHeaders := config.HasCustomHeadersDefined()
  	hasCorsHeaders := config.HasCorsHeadersDefined()
  
  	if !hasSecureHeaders && !hasCustomHeaders && !hasCorsHeaders {
  		return nil, errors.New("headers configuration not valid")
  	}
  
  	var handler http.Handler
  	nextHandler := next
  
  	if hasSecureHeaders {
  		logger.Debug("Setting up secureHeaders from %v", config)
  		handler = newSecure(next, config)
  		nextHandler = handler
  	}
  
  	if hasCustomHeaders || hasCorsHeaders {
  		logger.Debug("Setting up customHeaders/Cors from %v", config)
  		handler = NewHeader(nextHandler, config)
  	}
  
  	return &headers{
  		handler: handler,
  		name:    name,
  	}, nil
  }
docs: // New creates a Headers middleware.