I created a simple Flask application on my tiny VPS, and started by Gunicorn with a simple command gunicorn -w 2 -b 0.0.0.0:8888 app:app --access-logfile=- --proxy-protocol
.
I tried the code below on my local PC with Python requests
import requests
url= 'http://124.202.218.128:5000/new/'
resp = requests.post(url, data=data)
proxies = {'http': 'http://127.0.0.1:7890'}
resp2 = requests.post(url, data=data, proxies=proxies)
The resp
returned a correct data with HTTP code 200, the resp2
with a proxy get a 502 error code. This proxy http://127.0.0.1:7890
is valid when I use it in my browser.
How can I update flask or gunicord to receive data from proxied post?