Skip to content

Instantly share code, notes, and snippets.

@t0rr3sp3dr0
Last active June 12, 2025 23:37
Show Gist options
  • Save t0rr3sp3dr0/083d4f1bcf081498517f1834f7bb1e30 to your computer and use it in GitHub Desktop.
Save t0rr3sp3dr0/083d4f1bcf081498517f1834f7bb1e30 to your computer and use it in GitHub Desktop.
from mitmproxy import http
src = 'ax.init.itunes.apple.com'
dst = 'init.itunes.apple.com'
def request(flow: http.HTTPFlow) -> None:
if flow.request.pretty_host in (src, src + '.'):
flow.request.host = dst
def response(flow: http.HTTPFlow):
if 'Location' in flow.response.headers and dst in flow.response.headers['Location']:
flow.response.headers['Location'] = flow.response.headers['Location'].replace(dst, src)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment