Custom Middleware and Custom middleware bundle together


I am trying to load a plugin written in python (using in “post”). I already have a JS custom middleware (used as “pre”).

I see that when I load my Python middleware bundle, then the JS one does not load. Can someone please confirm if two custom middlewares can be used simultaneously?

Thank you,

Hi, can you confirm if you’re using both settings in the same API definition?

I think so. I see these

"custom_middleware": {
    "pre": [
            "name": "authMiddleware",
            "path": "/opt/tyk-gateway/middleware/authMiddleware.js",
            "require_session": false
    "post": [],
    "post_key_auth": [],
    "auth_check": {
        "name": "",
        "path": "",
        "require_session": false
    "response": [],
    "driver": "",
    "id_extractor": {
        "extract_from": "",
        "extract_with": "",
        "extractor_config": {}
"custom_middleware_bundle": "",

and manifest is

  "file_list": [
  "custom_middleware": {
    "driver": "python",
    "post": [
        "name": "OpenIDConnectDistributedClaimsConduit",
        "require_session": true
  "checksum": "",
  "signature": ""

We don’t support using two plugin drivers in the same API.
The bundler works in a way that it replaces the custom_middleware block with the contents of your bundle’s manifest file, this is the reason why JS stops working.

Possible solutions:

a) Port all the functionality to JS.
b) Port all the functionality to Python.
c) Create two APIs and use a language for each one, merge them under a third API.


1 Like

Thank you! I naively thought that the plugin bundles would be akin to Django’s middleware, where each layer is run but in a precedence. This makes a lot of sense now that I am seeing the middleware not being loaded.