binwiederhier / ntfy-android

Android app for ntfy.sh
Apache License 2.0
507 stars 104 forks source link

Don't add header 'Connection: close' for keep-alive JSON #29

Closed dcousens closed 2 years ago

dcousens commented 2 years ago

The /json?poll=1 request is kept alive for receiving application/x-ndjson as a stream, but the Connection header actually provided is connection: close, which is counter-intuitive to that request.

This shouldn't change behaviour for https://ntfy.sh but it can be helpful when using reverse proxies or other implementations.


I have not tested this change @binwiederhier , but I thought it better to propose the change than open an issue. Happy for you to say otherwise.

dcousens commented 2 years ago

Sorry, this is not the default (which is keep-alive), I forgot nginx automatically changes this header.

I'll leave the question to you @binwiederhier if the behavior of Connection: close is useful for the other requests. For nginx, you can add the following to retain what the application actually asks

proxy_set_header Connection $http_connection;