2

Using the library httpx which allows me to make HTTP/2 request to target sites.

However when I use the proxy it seem to automatically set my request to HTTP/1.

I.e

async def main():
    client = httpx.AsyncClient(http2=True)
    response = await client.get('someurl', headers=headers)
    print(response.http_version)

This prints HTTP/2

But same thing using proxy like so client = httpx.AsyncClient(http2=True, proxies=someproxydictionary)

it prints HTTP/1

Why is this behavior happening only when routing through proxies?

nardowick
  • 101
  • 1
  • 3
  • I would suggest firing up something like wireshark and looking at the outgoing packet. This might not be a python problem but a problem with the proxy downgrading your request to HTTP/1. If the packet going out of your machine is HTTP/2 then it is definitely the proxy's fault, otherwise we can investigate the python code... – Matteo Zanoni Dec 28 '21 at 09:07
  • When using the same proxy directly via my chrome requests are actually being routed from HTTP/2. After inspecting wireshark like you said it shows that my requests are made via HTTP/1. So I am assuming something wrong with python code. I saw a similar issue someone else posted using httpx library with proxy. – nardowick Dec 28 '21 at 09:33

0 Answers0