Transform_response_headers not applied to request

I’m struggling to set up an API that modifies the response headers or body. The definitions of ‘path’ and related config items is fuzzy enough that I’m not clear on what should be what. Body transform problems and questions - #2 by Martin states that “Response transforms need to be targetted on the rewritten URL, not on the inbound one.” but that’s not helping me where I am in Tyk knowledge yet.

my api config file is:

{
“name”: “Recs”,
“slug”: “recs”,
“api_id”: “1”,
“org_id”: “1”,
“use_keyless”: true,
“definition”: {
“location”: “header”,
“key”: “x-api-version”
},
“response_processors”: [
{“name”: “header_injector”},
{“name”: “header_transform”},
{
“name”: “response_body_transform”,
“options”: {}
}
],
“version_data”: {
“not_versioned”: true,
“versions”: {
“Default”: {
“name”: “Default”,
“use_extended_paths”: true,
“extended_paths”: {
“transform_headers”: [
{
“add_headers”: {“x-widgets-secret”: “the-secret-widget-key-is-secret”},
“path”: “/recs/{id}”,
“method”: “GET”
}
],
“transform_response_headers”: [
{
“add_headers”: {“x-server-id”: “this-is-important”},
“path”: “/recs/{id}/”,
“method”: “GET”
}
]
}
}
}
},
“proxy”: {
“listen_path”: “/”,
“target_url”: “http://0.0.0.0:20011/”,
“strip_listen_path”: true
},
“active”: true
}

the header specified in transform_headers is applied to the proxied request.

the request made during testing is, curl -I http://localhost:8022/recs/r90waeef9shidlk/

response body is as expected as well.

is there something more I need to install / enable to transform response headers/body? a config setting I’m missing? or, is there somewhere that clarifies what the ‘path’ should be in response transforms?

thanks!
dc

might help to add the config necessary for response header/body transforms within the context of this example:
https://tyk.io/docs/tyk-api-gateway-v-2-0/tutorials/set-up-your-first-api/

I would suggest removing the first slash from your path spec (recs instead of /recs)

I could have mentioned earlier, I have tried many variations of that path. with and without leading/trailing slash. not sure if it makes a difference, but there’s also another part to the path, the request is actually part1/recs/{id}.

is there a way to turn on more verbose logging that might have a report on why this isn’t being applied?