Merge branch 'reverse-proxy'

* reverse-proxy:
  Also disable insecure SSL settings
  Configuration updates for HTTP/2 and caching
  Add support for rverse redirection
  Also redirect nintendowifi.net for 3DS
  Replace request host header instead of host
  Update addon script to work with reverse proxy
  Set up reverse proxy config
This commit is contained in:
Matthew Lopez 2023-12-15 16:03:56 -05:00
commit a44495f59c
No known key found for this signature in database
GPG Key ID: 302A6EE3D63B7E0E
2 changed files with 16 additions and 13 deletions

View File

@ -1,14 +1,14 @@
# See https://docs.mitmproxy.org/stable/concepts-options/ for documentation
# An easy-to-remember port that should not conflict with anything
listen_port: 2240
web_port: 8088
listen_port: 8888
web_port: 8089
mode: reverse:http://127.0.0.1:81
keep_host_header: true
block_global: false
# These settings make sure that connections are not blocked because they use an
# old version of TLS.
ssl_insecure: true
tls_version_server_min: UNBOUNDED
tls_version_client_min: UNBOUNDED
# Disable HTTP/2 support, as it seems buggy and is not necessary
http2: false
# These just make sure that the right configuration files and certs are loaded.
client_certs: ./client-certificates/WiiU-common.pem
@ -16,11 +16,10 @@ confdir: ./configuration
# This enables the Pretendo redirection script.
scripts: ["./pretendo_addon.py"]
# This simply attempts makes sure that no requests are cached.
anticache: true
pretendo_redirect: true
# A couple convenience features
console_focus_follow: true
showhost: true
console_palette: dark
console_layout: vertical

View File

@ -19,9 +19,13 @@ class PretendoAddon:
def request(self, flow: http.HTTPFlow) -> None:
if ctx.options.pretendo_redirect:
if 'nintendo.net' in flow.request.host:
flow.request.host = flow.request.host.replace('nintendo.net', 'pretendo.cc')
if 'nintendo.net' in flow.request.pretty_host:
flow.request.host_header = flow.request.pretty_host.replace('nintendo.net', 'pretendo.cc')
elif 'nintendowifi.net' in flow.request.pretty_host:
flow.request.host_header = flow.request.pretty_host.replace('nintendowifi.net', 'pretendo.cc')
elif 'rverse.club' in flow.request.pretty_host:
flow.request.host_header = flow.request.pretty_host.replace('rverse.club', 'pretendo.cc')
if ctx.options.pretendo_http:
flow.request.scheme = 'http'