Enable CORS for Tyk Gateway API

Hi @Olu

Thank you so much for your kind help. I tried the API definition you had given but it is still throwing the same error. I tried to set the global_headers and it’s working. Not sure what went wrong and it could be my silly mistake again. Any idea what might be missing or mistakes made?

The API definition as follows:


{
  "name": "Get API Config List",
  "slug": "get-api-config-list",
  "api_id": "71",
  "org_id": "1",
  "use_keyless": true,
  "definition": {
    "location": "header",
    "key": "x-api-version"
  },
  "version_data": {
    "not_versioned": true,
    "versions": {
       "Default": {
         "name": "Default",
         "use_extended_paths" :true,
         "extended_paths": {
           "tranform_headers": [
             {
               "delete_headers": [],
               "add_headers": {
                 "x-tyk-authorization": "foo"
               },
               "path": "/",
               "method": "GET"
             }
           ]
         }
       }
     }
  },
  "CORS": {
    "enable": true,
    "allowed_origins": [
       "http://localhost:8080"
    ],
    "allowed_methods": [],
    "allowed_headers": [],
    "exposed_headers": [],
    "allowed_credentials": false,
    "max_age": 24,
    "options_passthrough": false,
    "debug": false
  },
  "proxy": {
    "listen_path": "/api/getAPIConfigList",
    "target_url": "http://localhost:8080/tyk/apis",
    "strip_listen_path": true
  },
  "active": true
}