# This file contains the base config for the reverse proxy, as part of ../Dockerfile-workers.
# configure_workers_and_start.py uses and amends to this file depending on the workers
# that have been selected.

{{ upstream_directives }}

server {
    # Listen on an unoccupied port number
    listen 8008;
    listen [::]:8008;

    server_name localhost;

    # Nginx by default only allows file uploads up to 1M in size
    # Increase client_max_body_size to match max_upload_size defined in homeserver.yaml
    client_max_body_size 100M;

{{ worker_locations }}

    # Send all other traffic to the main process
    location ~* ^(\\/_matrix|\\/_synapse) {
        proxy_pass http://localhost:8080;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $host;
    }
}
