Skip to content

Instantly share code, notes, and snippets.

@dthtvwls
Created March 16, 2021 23:48
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 dthtvwls/897e427168c74294c5686c37abd06060 to your computer and use it in GitHub Desktop.
Save dthtvwls/897e427168c74294c5686c37abd06060 to your computer and use it in GitHub Desktop.
CORS proxy
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