elk-zone / elk

A nimble Mastodon web client
https://elk.zone
MIT License
5.53k stars 567 forks source link

Doesn't work behind a subpath #1943

Open rafal06 opened 1 year ago

rafal06 commented 1 year ago

It doesn't work when put on a subpath via nginx instead of a separate (sub)domain

image

Here's my nginx config:

server {
    server_name fedi.rafal06.dev;

    location / {
        proxy_pass http://127.0.0.1:6000;
        proxy_set_header Host $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        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;
    }

    location ^~ /web/ {
        proxy_pass http://127.0.0.1:6100;
        proxy_set_header Host $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        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;
    }

    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    ssl_certificate /etc/letsencrypt/live/fedi.rafal06.dev/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/fedi.rafal06.dev/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    client_max_body_size 1024M;

}

server {
    if ($host = fedi.rafal06.dev) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    server_name fedi.rafal06.dev;

    listen 80;
    return 404; # managed by Certbot
}

And my docker-compose.yml:

version: "3.3"

services:
  gotosocial:
    image: superseriousbusiness/gotosocial:latest
    container_name: gotosocial
    user: 1000:1000
    networks:
      - gotosocial
    environment:
      GTS_HOST: fedi.rafal06.dev
      GTS_DB_TYPE: sqlite
      GTS_DB_ADDRESS: /gotosocial/storage/sqlite.db
      GTS_LETSENCRYPT_ENABLED: "false"
      GTS_LETSENCRYPT_EMAIL_ADDRESS: ""
      ## For reverse proxy setups:
      GTS_TRUSTED_PROXIES: "172.26.0.1"
    ports:
      - "127.0.0.1:6000:8080"
    volumes:
      - ./gotosocial:/gotosocial/storage
    restart: "always"
  elk:
    image: ghcr.io/elk-zone/elk:latest
    container_name: elk
    restart: "always"
    ports:
      - "127.0.0.1:6100:5314"
    volumes:
      - ./elk:/elk/data

networks:
  gotosocial:
    ipam:
      driver: default
stackblitz[bot] commented 1 year ago

Solve in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.