Created
March 16, 2021 23:48
-
-
Save dthtvwls/897e427168c74294c5686c37abd06060 to your computer and use it in GitHub Desktop.
CORS proxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request | |
from flask_cors import CORS | |
import requests | |
app = Flask(__name__) | |
CORS(app) | |
@app.route('/<path:path>') | |
def root(path): | |
r = requests.request(request.method, 'http://localhost:8001/'+path, headers=request.headers, data=request.data) | |
return r.text, r.status_code, r.headers.items() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment