|
@@ -0,0 +1,21 @@
|
|
|
+# -*- coding:utf-8
|
|
|
+import mitmproxy.http
|
|
|
+
|
|
|
+
|
|
|
+class ProxyForward:
|
|
|
+ def request(self, flow: mitmproxy.http.HTTPFlow) -> None:
|
|
|
+ url = flow.request.url
|
|
|
+ if url.startswith("https://eip-portal.qa.mlamp.cn/menura/ui"):
|
|
|
+ url = url.replace("https://eip-portal.qa.mlamp.cn/menura/ui", "http://127.0.0.1:8500/ui")
|
|
|
+ flow.request.url = url
|
|
|
+
|
|
|
+ def response(self, flow: mitmproxy.http.HTTPFlow):
|
|
|
+ flow.response.headers["test"] = "hhhh"
|
|
|
+ flow.response.headers["Content-Security-Policy"] = flow.request.host
|
|
|
+ pass
|
|
|
+
|
|
|
+ def error(self, flow: mitmproxy.http.HTTPFlow):
|
|
|
+ print(flow.error)
|
|
|
+
|
|
|
+
|
|
|
+addons = [ProxyForward()]
|