Hi,
1, ModHeader allows users to modify individual cookie in the cookie request header. This requires us to unpack the cookie request header, parse its value, and modify only a part of it. There is no equivalent API in DNR. I tried looking into the debugger API with Fetch domain. That too, did not work out properly, as the cookie header modification is ignored (
https://bugs.chromium.org/p/chromium/issues/detail?id=1200844)
2, ModHeader also allows users to modify individual set-cookie response header. This requires us to parse all the set-cookie response headers to find the matching cookie-name, then modify its value/attributes. There is no equivalent API in DNR either. Again, I tried looking into the debugger API with Fetch domain. That too, did not work out properly as set-cookie response header modification is also ignored (
https://bugs.chromium.org/p/chromium/issues/detail?id=1200844)
3, Operation: 'append' does not work (
https://bugs.chromium.org/p/chromium/issues/detail?id=1117475). In ModHeader, we allow users to append a request header value to an existing request header with the same name. I thought that is what the operation: 'append' mode would do. It does not work. Instead operation 'append' generates a cryptic error message like "Rule with id 1 must not specify a request header to be appended." ModHeader also support appending to existing request header with a comma in between. That way users can toggle request headers like ExperimentA,ExperimentB,ExperimentC. There is no equivalent append with comma operation in DNR.
4, Regex filters and exclude regex filters - ModHeader allows users to specify a list of regex filters + exclude regex filters. Unfortunately DNR only supports a single regex filter. Trying to combine a list of regex filters + a list of exclude regex filters into a single regex expression is extremely hard. If DNR conditions can be composite (like a condition can contain an "and" list and an "or" list of condition), then we can express more complex conditions like
condition: {
and: [
{ and: [ { regexFilter: regex1 }, { regexFilter: regex2 } ] },
{ or: [ { regexFilter: regex3 }, { regexFilter: regex4 } ] },
]
}
5, ModHeader supports some simple string substitution at runtime, like {{uuid}} would generate a random UUID each time it is evaluated, or {{timestamp}} would be substituted with the current timestamp in milliseconds, or {{url_path}} would be replaced with the request URL's path. DNR does not allow that.
We hope that the Chromium team will listen to feedbacks and make the DNR API more powerful.
Thanks,
Hao