0

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?

l0o0
  • 773
  • 1
  • 9
  • 26
  • Have you checked [this](https://stackoverflow.com/a/8287752/8353711) answer? – shaik moeed Aug 29 '23 at 15:21
  • @shaikmoeed I tried this and returned the same code. – l0o0 Sep 01 '23 at 08:31
  • How are you using the proxy in the browser? Can you elaborate on that in the post? – shaik moeed Sep 01 '23 at 11:01
  • @shaikmoeed Thanks for your reply. I used this proxy in my browser on SwitchyOmega Extension. 127.0.0.1:7890 used as a HTTP proxy. This proxy is provided by Clash for Windows. Is it enough for you to figure out? – l0o0 Sep 02 '23 at 16:10

0 Answers0