# Front nginx for spaceshell.ru — reverse-proxies the landing container and
# serves macOS .dmg downloads from the host-mounted ./download volume.
upstream landing_upstream {
    server landing:80;
}

server {
    listen 80;
    listen [::]:80;
    server_name spaceshell.ru www.spaceshell.ru;

    # Stable download URL: /download/spacesh.dmg → ./download/spacesh.dmg on host.
    location /download/ {
        alias /srv/download/;
        autoindex off;
        default_type application/octet-stream;
        add_header Content-Disposition "attachment";
        types {
            application/x-apple-diskimage dmg;
        }
    }

    location / {
        proxy_pass http://landing_upstream;
        proxy_set_header Host              $host;
        proxy_set_header X-Real-IP         $remote_addr;
        proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
