Hey @Ruttie! Let me start with your last comment since it’s the easies to answer:
Maybe there is some kind of ‘secret’ transfer type I could use for more performance (e.g. using UDP since packet loss over socket to localhost is unlikely)?
UDP is actually used by HTTP/3 with quic! When it works, it works quite well. However, it is still a very recent standard and the level of adoption varies amongst clients and browsers. NGINX released experimental support for HTTP/3 a couple years ago and you can enable it via the http v3 module. You can find the latest data re the various levels of HTTP/3 client/server implementations here https://interop.seemann.io.
Should I accept both HTTP/1.1 and HTTP2 (e.g. to allow nginx to directly pass data)?
Should I only accept HTTP2 and configure nginx to convert HTTP/1.1 (e.g. because nginx parses requests anyways, and HTTP2 would allow using fewer sockets thanks to multiplexing)?
This is a slightly more tricky question to answer. There are both potential performance improvements and drawbacks when using HTTP/2 over HTTP/1.1. This is one of those cases where the answer truly is “it depends on your use case”. I would suggest reading through this O’Reilly article (or any number of other articles you can find online) and determining what version (or even whether both versions) of HTTP better fits your use case.
Long term, HTTP/3 is likely going to become the defacto standard, but we are at best still a few years away from reaching full scale mass adoption.