Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Unable to Add Non-Standard Headers Using Declarative Net Request Rule (DNR) in Safari

We’re encountering an issue when trying to add non-standard headers to outgoing requests using Declarative Net Request (DNR) rules in our Safari Web Extension. Tested on macOS 15.4 with Safari 18.4.

Specifically, when attempting to add a custom header such as "X-Custom-Header" using a DNR rule, the header does not appear in the request. We are able to add standard headers like "Authorization" and "Cookie" to the request successfully using the same method.

This behavior suggests that Safari may be filtering or blocking non-standard headers when set via DNR rules, unlike other browsers.

In Chrome and Firefox, the same rule adds the "X-Custom-Header" header without any issue.

We are looking for assistance in fixing these issues and having our Safari Extension function the same as it does in Firefox and Chrome.

Safari limits the headers that can be modified to a set of known headers that is listed at:

https://github.com/WebKit/WebKit/blob/aa49cd4d27107bd400dbbffc2542ddd5e30ab8ed/Source/WebKit/UIProcess/Extensions/Cocoa/_WKWebExtensionDeclarativeNetRequestRule.mm#L552

Can you please file feedback at https://feedbackassistant.apple.com explaining your use case and what you'd like to do?

Thanks!

I filed a WebKit bug about this here: https://bugs.webkit.org/show_bug.cgi?id=290922

I've had several users of my extension request custom headers, though I'm not sure which headers exactly.

Unable to Add Non-Standard Headers Using Declarative Net Request Rule (DNR) in Safari
 
 
Q