Mercure.rocksSponsored by


Handling More Simultaneous Connections

If you have errors such as accept: too many open files. in your logs, you may need to increase the maximum number of file descriptors allowed by the operating system. To do so, use the ulimit -n command.


ulimit -n 100000

You may also be interested in spreading the load across several servers using the HA version.

To reproduce the problem, we provide a load test that you can use to stress your infrastructure.

Using NGINX as an HTTP/2 Reverse Proxy in Front of the Hub

NGINX is supported out of the box. Use the following proxy configuration:

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    ssl_certificate /path/to/ssl/cert.crt;
    ssl_certificate_key /path/to/ssl/cert.key;

    location / {
        proxy_pass http://url-of-your-mercure-hub;
        proxy_read_timeout 24h;
        proxy_http_version 1.1;
        proxy_set_header Connection "";

        ## Be sure to set USE_FORWARDED_HEADERS=1 to allow the hub to use those headers ##
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;