# Example nginx location block for ihasmail behind TLS termination. server { listen 443 ssl http2; server_name mail.example.com; # ssl_certificate ...; ssl_certificate_key ...; client_max_body_size 60m; # Compression. The bundle is the bulk of first load -- about 933 KB # uncompressed against 311 KB gzipped -- and nginx passes through anything # the upstream already encoded rather than re-encoding it, so this is # correct whether or not ihasmail compresses on its own. # # text/event-stream is deliberately absent from gzip_types: the push stream # must not be compressed or buffered, which is also why proxy_buffering is # off below. gzip on; gzip_vary on; gzip_proxied any; gzip_comp_level 5; gzip_min_length 1024; # text/javascript is listed explicitly: ihasmail serves scripts with that # type rather than application/javascript, so a conventional gzip_types # list compresses the stylesheet and leaves the largest asset alone. gzip_types application/javascript application/json application/manifest+json image/svg+xml text/css text/javascript text/plain; location / { proxy_pass http://127.0.0.1:8080; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; # Server-Sent Events (push notifications) proxy_buffering off; proxy_read_timeout 3600s; } }