What is Nostr?
Anthony Accioly
npub1a6w…0tyc
2024-11-15 23:52:09

Anthony Accioly on Nostr: π“πˆπ‹: When acting as a reverse proxy, Nginx uses HTTP/1.0 and doesn’t ...

π“πˆπ‹: When acting as a reverse proxy, Nginx uses HTTP/1.0 and doesn’t enable πš”πšŽπšŽπš™πšŠπš•πš’πšŸπšŽ (HTTP persistent connections) to upstream servers by default. My reverse proxy was happily responding to clients using HTTP/1.1 or HTTP/2.0 while still using HTTP/1.0 to connect to my personal relay.

I didn’t think it would make much of a difference, given that Nostr is WebSocket-basedβ€”i.e., HTTP connections are quickly upgraded with:

π™²πš˜πš—πš—πšŽπšŒπšπš’πš˜πš—:β€€πš„πš™πšπš›πšŠπšπšŽ
πš„πš™πšπš›πšŠπšπšŽ:β€€πš πšŽπš‹πšœπš˜πšŒπš”πšŽπš

Plus, my personal relay isn’t exactly handling a lot of traffic.

Nevertheless, configuring a small number of cached connections apparently reduced CPU usage, not only for Nginx but also for Haven itself. The more you know...

I’ve enabled persistent connections for Nginx on my Haven repo and merged girino (npub18la…cfsz)'s latest contribution from upstream. Do let me know if you encounter any issues.

https://www.f5.com/company/blog/nginx/avoiding-top-10-nginx-configuration-mistakes#no-keepalives

#Haven #Nginx #HTTP #ReverseProxy #WebSockets #Nostr
Author Public Key
npub1a6we08n7zsv2na689whc9hykpq4q6sj3kaauk9c2dm8vj0adlajq7w0tyc