setting bereq.http headers in vcl_fetch doesn't work?
I'm trying to set some headers on the backend request, and it's not working.
https://developer.fastly.com/reference/vcl/variables/miscellaneous/bereq-http/
says "bereq.http.
STRING, can be read, set
and unset
.
but when I try to set a bereq,http header in vcl_fetch, it doesn't seem to do anything. I have a fiddle set up at https://fiddle.fastlydemo.net/fiddle/1d8cc830 which sets req.http.x-req-header in vcl_recv, and bereq.http.x-bereq-header in vcl_fetch. But you can see that the bereq.http.x-bereq-header never seems to get set. What's up?
-
Hi JD!
Setting a bereq-header in fetch wouldn't change the header because the backend has already been called by the time fetch is run.
I used the fiddle to appended and set the bereq-header in miss and pass and both of those worked.
I do see in the documentation you linked that it doesn't clarify that it wont throw an error but that unset is what works in fetch and set would have no effect. I will get that clarified!
Please sign in to leave a comment.
Comments
2 comments