Skip to content

Conversation

@UwUDev
Copy link
Collaborator

@UwUDev UwUDev commented Aug 9, 2025

I set ALPN on the rustls config so the server actually advertises "h2". Without that, browsers were sticking to HTTP/1.1 even though .http2() was enabled. Switching from the self-signed cert to Let’s Encrypt made it obvious ALPN wasn’t set, so HTTP/2 never negotiated. This fixes it by explicitly advertising h2, with fallbacks to HTTP/1.1, then 1.0, then 0.9 for odd clients.

I changed the error handling to get this in. It would be better to add a dedicated error for ALPN/TLS config (see src/error.rs lines 36–37) instead of the generic path I used but i don't really know what to set.

Also, if you add h3 or httpbis later it would be nice to have a way to change the HTTP versions priorities.

@0x676e67
Copy link
Owner

0x676e67 commented Aug 9, 2025

The upstream indeed does not configure ALPN for the custom certificate chain. Perhaps I should report this to the upstream. I wonder if they overlooked it or what?

https://github.com/programatik29/axum-server/blob/f60b6150bba0aecf4910f877fd0bc12ac24d030b/src/tls_rustls/mod.rs#L349

https://github.com/programatik29/axum-server/blob/f60b6150bba0aecf4910f877fd0bc12ac24d030b/src/tls_rustls/mod.rs#L292

@UwUDev
Copy link
Collaborator Author

UwUDev commented Aug 9, 2025

I don't know, that's strange. You can try to reproduce this by trying with the self-signed certificate and then with a Certbot certificate. You'll see that it switches from HTTP/2.0 to HTTP/1.1

@UwUDev
Copy link
Collaborator Author

UwUDev commented Aug 9, 2025

But it would still be nice to be able to change the default HTTP version of Pingly, or even disable some of them.

@0x676e67
Copy link
Owner

0x676e67 commented Aug 9, 2025

Sorry, I accidentally messed up the branch. Please copy the content from the fix branch and raise a new PR

https://github.com/0x676e67/pingly/tree/fix

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

Successfully merging this pull request may close these issues.

2 participants