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

Keep-Alive not working for HTTP forwarded traffic (CloudFlare related) #968

Open
Power2All opened this issue Jul 21, 2024 · 2 comments
Open

Comments

@Power2All
Copy link
Contributor

Figured out with Actix (which Torrust isn't using) doesn't handle Keep-Alive when traffic from CloudFlare is coming from a pure HTTP (port 80) protocol. It seems it only works on HTTP/2 traffic, and in HTTPS (SSL). The Keep-Alive is then triggered, and lowers the amount of connections significantly.
I applied a HTTP to HTTPS forward through CloudFlare, with an 301 permanent forward setting, which seems to have solved the issue.

This might come in handy for people who run this tracker behind CloudFlare.

This information might be handy to know for @josecelano

@josecelano
Copy link
Member

Hi @Power2All, Thank you for sharing it. Sorry for the delay; I was on holiday :-). I wonder how you monitor the number of connections and how you realized those connections were not being used.

What is the expected behaviour from Actix? Should Actix keep the connection open to reuse it (when the client is using Http 1.1), so the total number of connections is lower?

I've been reading that HTTP2 and HTTP3 don't use this header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Keep-Alive. These newer protocols already keep the connection open.

@Power2All
Copy link
Contributor Author

Power2All commented Jul 29, 2024

Hi @Power2All, Thank you for sharing it. Sorry for the delay; I was on holiday :-). I wonder how you monitor the number of connections and how you realized those connections were not being used.

What is the expected behaviour from Actix? Should Actix keep the connection open to reuse it (when the client is using Http 1.1), so the total number of connections is lower?

I've been reading that HTTP2 and HTTP3 don't use this header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Keep-Alive. These newer protocols already keep the connection open.

No worries, hope you had a fun vacation :)

I can monitor them through the "ss -s" command in Linux. Active connections tracked are shown there.
Keep-Alive will keep it's connection with CloudFlare in this case, open for more to handle for an X amount of seconds. This works only so far I read, for HTTP/1.1 and HTTP/2 (and probably also HTTP/3) requests. And yes, the total number of connections should lower significantly.

Yes, you are right that Keep-Alive is ignored on HTTP2, is because HTTP2 already utilizes a Keep-Alive behavior. The Keep-Alive is basically only meant for HTTP/1.1

Currently Gbitt runs in UDP only mode, as the bandwidth usage exceeded my limitation (roughly 50TB per month). UDP has been optimized a lot, using more threading to alleviate the incoming packets.

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