Enable CORS for Tyk Gateway API

Hi @kamikazane, there were 2 things wrong.

First is the structure of the API def was off. extended_paths is a child of the version and not at the root. You can find a sample structure of the API definition here

Second was the value of path property in the transform_headers is actually a subpath and not {{ path / subpath }}, like I shared earlier. In your case, making it the root should work.

I have pasted the API definition that should work for your environment. Please check the values are accurate and try again

{
  "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": {
        "use_extended_paths": true,
				"extended_paths": {
					"transform_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
}