bin/init --tls, NGINX_* and TLS_* in overleaf.rc) has no counterpart; see TLS proxy for the Toolkit.
What the proxy must do
- Pass WebSockets (
/socket.io). - Allow requests of 10 minutes (long compiles) and request bodies of 50 MB (uploads), or
MAX_UPLOAD_SIZE. - Keep its idle keep-alive timeout towards the pods below 65 seconds, the timeout of the nginx in the pod.
- Send
X-Forwarded-ForandX-Forwarded-Proto: https. - With several replicas, keep a user on one replica, see Horizontal scaling.
ConfigMap
X-Forwarded-Proto: https from a trusted address, Ayakaleaf Pro thinks requests arrive over HTTP and does not set its secure session cookie: logins then fail. Set OVERLEAF_SECURE_COOKIE only when users really reach the site over HTTPS; any value turns it on, also "false".
HAProxy example
To terminate HTTPS in the HAProxy DaemonSet of Horizontal scaling, put the certificate and its key into one PEM file and a Secret:80-haproxy.yaml:
80-haproxy.yaml (changes)
config-hash so that HAProxy restarts, then set the ConfigMap as above and restart the replicas.
The redirect keeps the port of the request: it suits a load balancer on ports 80 and 443, but on the NodePorts it sends http://host:30081 to https://host:30081. Without a load balancer in front, leave the redirect line out and give users the https://...:30443 address.
Tested on Kubernetes
On Kubernetes 1.37 with three replicas and HAProxy terminating HTTPS as above, withOVERLEAF_SITE_URL on https:// and OVERLEAF_SECURE_COOKIE: users activated through https:// links, logged in with a session cookie marked Secure, uploaded and compiled projects with the PDF fetched, stayed on their replica, opened the editor’s WebSocket (wss), and cloned and pushed with Git over HTTPS. http:// requests on the NodePort were redirected to https:// with the same port, as described above.
