pluvial / svelte-adapter-deno

A SvelteKit adapter for Deno
https://svelte-adapter-deno.deno.dev/
MIT License
313 stars 14 forks source link

Assets throw a 404 when running behind a reverse proxy. #35

Closed VentGrey closed 1 year ago

VentGrey commented 1 year ago

I'm using this adapter to run a site, however, the static content like images and CSS styles get behind and directly throw a 404.

This is my systemd unit service:

[Unit]
Description = Sveltekit Deno

[Service]
Type = simple
User = www-data
Group = www-data
LimitNOFILE = 4096
Restart = always
RestartSec = 5s
ExecStart = /usr/bin/deno run --allow-env --allow-read --allow-net /var/www/html/site.com/build/index.js

[Install] 
WantedBy = multi-user.target

The NGINX configuration i'm using is the following (the important proxy part):

    location / {
        proxy_set_header Connection '';
            proxy_http_version 1.1;
            proxy_read_timeout 180s;

            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;
            proxy_set_header X-NginX-Proxy true;

            proxy_pass http://localhost:3000;
    }

However this results in an error when going to the main site:

image