/cors-proxy

Simple Flask-based CORS proxy

Primary LanguagePython

cors-proxy

A Flask-based proxy that adds CORS headers to every responses.

Note: Every headers are forwarded but Content-Encodind that causes issues with Flask and Forbidden headers. Cookies path are removed as it won't correspond the proxy path.

Table of Contents

Installation

Install the dependencies with

pip install -r requirements.txt

You can either run the proxy with

# for local debugging
python proxy.py

# for production
gunicorn -b 0.0.0.0:8080 server:app

Or deploy it with Fly.io with the Dockerfile. Ensure to install flyctl beforhand.

Usage

You can then access http://127.0.0.1:5000/<url> for any url and any HTTP method. The response content and return code will be forwarded.

Example: Access https://jsonplaceholder.typicode.com/posts with http://127.0.0.1:5000/https://jsonplaceholder.typicode.com/posts.