setUpstreamResponseHeader does not allow to set surrogate keys

According to this documentation: https://developer.moovweb.com/docs/api/core/classes/router_responsewriter.responsewriter.html#setupstreamresponseheader

I should be able to set the surrogate key for proxy pages in the xdn router. When I try to do this error is thrown:
Error: Header “x-xdn-surrogate-key” is reserved and cannot be modified

Is the documentation wrong or is this a bug?

The documentation is wrong - sorry about that (we will fix it ASAP). The surrogate keys usually involve some database lookup and are rarely known in advance. The x-xdn-surrogate-key is thus meant to be set on your serverless layer.

What is your use case?

@ierceg
Just what I described above. We have got legacy pages that we have little control of. We want to cache these pages on the xdn but still have the capability of clearing all of the via surrogate key. This was the simplest solution for us.

Do you have a recommended way to do this for us?

We are looking into to adding this soon. Logged as XDN-10802

In the meantime, you would need to manually trigger the collection of URLs via API, or you can define a collection of URLs into a group and clear them from the console that way.

1 Like

@siggnja We release v2.52.1 which allows setting of x-xdn-surrogate-key. The same has been released in v3.0.1 for x-0-surrogate-key.

1 Like