6a5* | Wellorder relay does not work on Damus [bug] · Issue #874 · damus-io/damus
https://github.com/damus-io/damus/issues/874
Saved on 2023-04-05 [19452 edays] via github.com
Modified 2023-09-04 [19604 edays]
nostr postmortem web

Interesting bug we found between Damus & HAProxy. Turns out, sending a Host HTTP header with a port number is asking for weird behavior.

My comment reproduced below.

Found & fixed. Here was the critical difference between a Damus request and all other known clients. For a relay such as wss://nostr-pub.wellorder.net, other clients send a request with an HTTP host header of nostr-pub.wellorder.net. In contrast, Damus will send nostr-pub.wellorder.net:443.

I have an HAProxy ACL that selects the backend service based on the host header, and it was set to perform a case-insensitive match against nostr-pub.wellorder.net - what Damus sent did not match this or anything else, and so my server was sending a 503. Relay info requests were not affected, because those did send a host header without the unnecessary port number.

Is it wrong to send the default port number (80 or 443) in the host header? Not really, but it is rare since browsers, curl, and all other clients I'm aware of omit default port numbers in host headers. Notably, even the HAProxy documentation doesn't anticipate port numbers added for default ports, and promotes a configuration that would fail.

So - mystery solved. I've updated my running HAProxy instances on Wellorder; and updated the reverse proxy docs in my nostr-rs-relay repo.