Reverse Proxy with NGINX

When using Cadenza behind an NGINX reverse proxy here are some things to look out for:

Disable Proxy Buffering

Cadenza uses server sent events (SSE) as mentioned on the parent page. To prevent issues with NGINX buffering content, you will have to disable proxy buffering:

server {
		…
        location /cadenza {
				…
                proxy_buffering off;
                …
        }
}

Common Problems with nginx as Reverse Proxy

Increase the Header Buffer Size

When using identity management products like Keycloak, the authorization header can be quite big and thus the proxy requests might fail. To mitigate the issue, you will need to increase the default value of a directive. These directives must be placed in the http or server context.

large_client_header_buffers 4 32k;

Requests with OPTIONS

HTTP OPTIONS requests can lead to a wrong HTTP reponse code (HTTP 204 — No Content instead of HTTP 200 — OK) when using nginx on Kubernetes. The following setting allows these requests:

nginx.ingress.kubernetes.io/enable-cors: "true"

Kubernetes Ingress with Additional Reverse Proxy

Using an additional reverse proxy in front of the Ingress controller can lead to various problems on Kubernetes. Possible errors include wrong internal links with the hostname from the Ingress instead of the hostname from the reverse proxy or CORS errors because the hostname from the external reverse proxy is not being used in the links for generated POST requests. The following annotation in the Ingress definition should solve problems resulting from the usage of the wrong hostname:

nginx.ingress.kubernetes.io/upstream-vhost: "<hostname-for external-access>"

NGINX Reports 413 Request Entity Too Large Error

When you get a client side error during upload either in Cadenza or the devtools with a status code 413 and the message Request Entity Too Large you are most likely running into a reverse proxy configuration problem.

Not just Cadenza has limitations on the size of uploads, but your reverse proxies can also limit this.

In NGINX you need to set client_max_body_size to a larger value. The default is 1m. See the NGINX documentation for this property.