SimpleModifyHeaders icon indicating copy to clipboard operation
SimpleModifyHeaders copied to clipboard

Add action: Replace String in Response Value

Open lukakoning opened this issue 1 year ago • 0 comments

With these changes I add the option to replace a string in the value of a response header.

One can select this action in the table of the config menu. Under the header field value you then provide a pattern like so: (text to search for)(text to replace with). For example (apple)(boat) will replace 'apple' with 'boat' in the value of the response header.

I was looking for this feature since I needed to change the Content-Security-Policy of a page. However, the Content-Security-Policy was dynamically crafted with nonces. I did not want to delete the entire CSP; I wanted a CSP with these nonces still in there. As a regular modify (always to one certain, pre-specified value) could not achieve this, I needed a string replace option.

Hereby I share that feature. If it gets accepted to the master branch, the README.md would still have to be updated to explain this feature.

lukakoning avatar Apr 06 '24 09:04 lukakoning