Skip to content

enable HTTP/1.1 for nginx <-> backend #1736

@brontolosone

Description

@brontolosone

Related: getodk/central-backend@fa85d3e6

Nginx' default for proxied upstreams is to use HTTP/1.0.

In several places we use streaming responses, and in some of those (/v1/backup for sure) we want to be able to have it clientside detectable if stream production at the server crashes (as that can then inform further action clientside, for instance, toss the downloaded backup file if the download was incomplete and try anew).
Absent a way to instruct Node to send a TCP RST, we can use chunked transport encoding to achieve that, as those need to be finalized with a 0-length chunk, and if it's absent yet the TCP connection has been closed (eg with FIN), then the http client can tell. And in fact, at least curl does tell, it even has a dedicated exit code for incomplete transfers, and I presume HTTP libraries worth their salt also have some way of detecting this case.

So we want to use chunked transport encoding, and for that we need nginx to talk HTTP/1.1 to the backend server. There's a directive for that: proxy_http_version.

Metadata

Metadata

Assignees

Labels

opsDocker, nginx, ops to deploy CentralrefactorImproves code without altering behavior

Type

No type
No fields configured for issues without a type.

Projects

Status

✏️ in progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions