Add global response header

Hi all,

Based on the following issue ((mw) global response header transform middleware · Issue #2453 · TykTechnologies/tyk · GitHub) and the corresponding pull request, we should be able to add a global response header for all responses of our API definition using the global_response_headers configuration and the response_processors configuration to register the response processor middleware. Currently, we are on version 2.9.1 of the Tyk API Gateway and looking at the code of that version, this functionality should be available (although not documented). However, it does not seem to be working for me and we’re clueless on what we’re missing here. Any ideas?

Our API definition looks like this (we’re trying to add the Strict-Transport-Security header to all responses):

               "Strict-Transport-Security":"max-age=31536000; includeSubDomains"


1 Like


Global response headers was added as part of Release 3.
Thats why it probably does not work for you.


Hm, I had found the code that was added in the pull request for this issue in tag 2.9.1 in the repository. For example:


So that’s why I concluded that it was already part of v2.9.1 as well. Am I making the wrong conclusion then?

Anyone has some input on my question above? :sweat_smile:

Hello @djairhogeuens those features could have not been enabled then. I will look further into this and confirm. Is there a reason to why you’re using 2.9.1 and not switching to 3.x?

I just switched to the latest available version 3.1.2 and this resolved the issue indeed. I had not yet looked into the release notes so I was afraid there would be too much impact but it was flawless :slight_smile:

I still find it strange that the 2.9.1 tag already includes this code will it doesn’t work. But at least my problem is solved now.

Hello @djairhogeuens yes. The code is in there however, it was not enabled at that point.

For future references Tyk has backward and forward compatibility so you should have no problem moving between versions. The only thing you will lose in backward compatibility is the features associated with the versions.

1 Like

Oh thanks @zaid for clarifying that. I was indeed unaware of this and now I understand!

1 Like