set missing header

can i configure a request header transform rule to set a header if it doesnt exist?
6 Replies
Idle
IdleOP14mo ago
e.g if the http request referer header does not exist, set it to a default value
Erisa
Erisa14mo ago
Expression:
!any(http.request.headers.names[*] == "myheader")
!any(http.request.headers.names[*] == "myheader")
Erisa
Erisa14mo ago
And then just set the header as the action
No description
Erisa
Erisa14mo ago
can be seen in action on https://headers.erisa.uk which is a worker that returns the request headers in the body and will default myheader to defaultvalue
Erisa
Erisa14mo ago
In my expression you could swap out ! for not and == for eq and it would work the same My brain tries to treat it like code so I end up using the C-like notations notlikemeow
Want results from more Discord servers?
Add your server