diff --git a/config/config.go b/config/config.go index 55b50d85c0f..f3b24f4c04d 100644 --- a/config/config.go +++ b/config/config.go @@ -771,6 +771,9 @@ type Config struct { // Note: // If you set `db_app_conf_options.node_is_segmented` to `true` for multiple Gateway nodes, you should ensure that `management_node` is set to `false`. // This is to ensure visibility for the management node across all APIs. + // + // For pro installations, `management_node` is not a valid configuration option. + // Always set `management_node` to `false` in pro environments. ManagementNode bool `json:"management_node"` // This is used as part of the RPC / Hybrid back-end configuration in a Tyk Enterprise installation and isn’t used anywhere else. diff --git a/gateway/coprocess_bundle.go b/gateway/coprocess_bundle.go index 3c634f76fbc..1071ad6a626 100644 --- a/gateway/coprocess_bundle.go +++ b/gateway/coprocess_bundle.go @@ -355,6 +355,10 @@ func (gw *Gateway) getHashedBundleName(bundleName string) (string, error) { // loadBundle wraps the load and save steps, it will return if an error occurs at any point. func (gw *Gateway) loadBundle(spec *APISpec) error { + if gw.GetConfig().ManagementNode { + return nil + } + // Skip if no custom middleware bundle name is set. if spec.CustomMiddlewareBundleDisabled || spec.CustomMiddlewareBundle == "" { return nil diff --git a/gateway/coprocess_bundle_test.go b/gateway/coprocess_bundle_test.go index 62dc320694a..2266867fe6d 100644 --- a/gateway/coprocess_bundle_test.go +++ b/gateway/coprocess_bundle_test.go @@ -130,6 +130,23 @@ func TestBundleLoader(t *testing.T) { assert.NoError(t, err) }) + t.Run("load bundle should not load bundle nor error when the gateway instance is a management node", func(t *testing.T) { + customTs := StartTest(func(globalConf *config.Config) { + globalConf.ManagementNode = true + }) + + t.Cleanup(customTs.Close) + spec := &APISpec{ + APIDefinition: &apidef.APIDefinition{ + CustomMiddlewareBundle: "some-bundle", + CustomMiddlewareBundleDisabled: false, + }, + } + err := customTs.Gw.loadBundle(spec) + assert.Empty(t, spec.CustomMiddleware) + assert.NoError(t, err) + }) + t.Run("Load bundle fails if public key path is set but no signature is provided", func(t *testing.T) { cfg := ts.Gw.GetConfig() cfg.PublicKeyPath = "random/path/to/public.key"