Really simple HTTP API proxy. Just configure a URL whitelist, some optional headers (e.g. CORS), a port and run.
Copy or move .env.tmp to .env, then set WHITELIST
and HEADERS
accordingly.
It is a list of regular expressions for allowed URLs to your API instance.
Here's an example to allow anything:
WHITELIST=[".+"]
Here's another to only allow request to google and bing search:
WHITELIST=["https:\/\/(?:www\.)?google\.com\/search\?q=.+", "https:\/\/(?:www\.)?bing\.com\/search\?q=.+"]
It is a map with a specific header as key, and it's corresponding key/value for the HTTP header response.
CORS is defined by default:
HEADERS={"cors": ["Access-Control-Allow-Origin", "*"]}
Set the port your API will listen to. Default value is 5000
.
Run with docker or install dependencies with pip install -r requirements.txt
and then run with python app.py
Call your API with a mandatory url
parameter and optional headers
parameter. E.g.: HTTP GET -> http://127.0.0.1:5000/?headers=cors&url=https://www.google.com/search?q=kittens
Feel free to submit any issue or PR!
GNU GPL v3