Skip to content

Instantly share code, notes, and snippets.

@stefanschmidt
Last active March 5, 2022 00:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanschmidt/01afe77220fc3b31be50e62d57431631 to your computer and use it in GitHub Desktop.
Save stefanschmidt/01afe77220fc3b31be50e62d57431631 to your computer and use it in GitHub Desktop.
Charles Proxy rewrite rule to remove object-src 'none'; from HTTPS response headers for PDF files from afaa.com to enable display in Safari avoiding "Blocked Plugin-In" error
<?xml version='1.0' encoding='UTF-8' ?>
<?charles serialisation-version='2.0' ?>
<rewriteSet-array>
<rewriteSet>
<active>true</active>
<name>AFAA</name>
<hosts>
<locationPatterns>
<locationMatch>
<location>
<protocol>https</protocol>
<host>www.afaa.com</host>
<path>*.pdf</path>
</location>
<enabled>true</enabled>
</locationMatch>
</locationPatterns>
</hosts>
<rules>
<rewriteRule>
<active>true</active>
<ruleType>3</ruleType>
<matchHeader>content-security-policy</matchHeader>
<matchValue>(.*)object-src &apos;none&apos;;(.*)</matchValue>
<matchHeaderRegex>false</matchHeaderRegex>
<matchValueRegex>true</matchValueRegex>
<matchRequest>false</matchRequest>
<matchResponse>true</matchResponse>
<newHeader>content-security-policy</newHeader>
<newValue>$1$2</newValue>
<newHeaderRegex>false</newHeaderRegex>
<newValueRegex>false</newValueRegex>
<matchWholeValue>false</matchWholeValue>
<caseSensitive>false</caseSensitive>
<replaceType>1</replaceType>
</rewriteRule>
</rules>
</rewriteSet>
</rewriteSet-array>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment