Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible HTTP/2 Incompatibility #224

Open
sparked435 opened this issue May 29, 2024 · 3 comments
Open

Possible HTTP/2 Incompatibility #224

sparked435 opened this issue May 29, 2024 · 3 comments

Comments

@sparked435
Copy link

This might not be a lua-http issue; but only lua-http shows this behavior on sites using the Fastly CDN. The following works, outputting "200", as expected:

local req = httpreq.new_from_uri( 'https://www.bbc.com/robots.txt' )
req.version = 1

local headers, body = req:go(5)
print(headers:get(':status'))

Switching req.version to either nil or 2 returns a 403. I spent some time ensuring Curl and lua-http were sending identical headers; lua-http gets 403 for HTTP/2 and Curl always gets a 200 regardless of version. Web browsers consistently succeed as well.

Environment is Lua 5.4, lua-http 0.4, cqueues 20200726.54, and luaossl 20220711.

@daurnimator
Copy link
Owner

It appears as though BBC have opted into some kind of fastly "bot-prevention" feature?

@sparked435
Copy link
Author

Whatever Fastly is doing was probably was intended to be something like that.

That said, I can run a few hundred requests with lua-http returning 403, and then run Curl with the exact same headers from the exact same IP and get a 200 - so it's upset at something lua-http specific and not the IP appearing to act like a bot/scraping/hitting an denied URL.

Is there a way to force lua-http to speak HTTP/2 but over unencrypted TCP? That way I could use stunnel and try to debug further with a packet sniffer.

@daurnimator
Copy link
Owner

Is there a way to force lua-http to speak HTTP/2 but over unencrypted TCP? That way I could use stunnel and try to debug further with a packet sniffer.

sure. you should be able to use a http url and then set

req.version = 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants