Skip to content

CORS error with nginx reverse proxy #255

@Sharpie171

Description

@Sharpie171

I have followed the setup in the Readme a few times. I have redacted my domain to use example.com in this issue.

When I attempt to register a new user, a CORS error occurs because the application attempts to reach https://example.com/api/auth/account/create? instead of https://stoat.example.com/api/auth/create?

Image

Can I correct the CORS request so that it uses the stoat.example.com subdomain with the configs?

My configuration files follow, using example.com instead of my real domain:

Here is my nginx config, it contains other configuration for subdomains to other self-hosted applications so it doesn't make sense to handle stoat traffic through the regular https://example.com

# nginx.conf
http {
    server {
        server_name example.com;
        listen 443 ssl; 
        # Certbot SSL configuration
    }
    # Jellyfin
    server {
        listen 443 ssl;
        server_name jellyfin.example.com;
        # Jellyfin Reverse Proxy config
        }
    # Taiga
    server {
        listen 443 ssl;
        server_name taiga.example.com;
        # Taiga Reverse Proxy config
        }
    # Stoat
    server {
        listen 443 ssl;
        server_name stoat.example.com;
        location / {
            allow all;
            proxy_pass http://localhost:8880;
            proxy_set_header Host $server_name;
            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 /ws {
            allow all;
            proxy_pass http://localhost:8880;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host $server_name;
            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 /livekit {
            allow all;
            proxy_pass http://localhost:8880;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host $server_name;
            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;
        }
    }
}

Here is my .env.web file, it hasn't been changed after running ./generate_config.sh:

# .env.web
HOSTNAME=:80
REVOLT_PUBLIC_URL=https://stoat.example.com/api
VITE_API_URL=https://stoat.example.com/api
VITE_WS_URL=wss://stoat.example.com/ws
VITE_MEDIA_URL=https://stoat.example.com/autumn
VITE_PROXY_URL=https://stoat.example.com/january

I have pretty old hardware (the CPU I have is from 2008) so I had to alter the compose.yml file to use docker images that my old hardware can handle. Could this be the cause of the issue? Below are the changes from the standard compose.yml

# compose.yml (changes only)
services:
  # MongoDB: Database
  database:
    image: docker.io/mongo:4.4
    restart: always
    volumes:
      - ./data/db:/data/db
    healthcheck:
      test: echo 'db.runCommand("ping").ok' | mongo localhost:27017/test
      interval: 10s
      timeout: 10s
      retries: 5
      start_period: 10s

  # Redis: Event message broker & KV store
  redis:
    image: docker.io/eqalpha/keydb:x86_64_v6.3.3
    restart: always
  # MinIO: S3-compatible storage server
  minio:
    image: docker.io/minio/minio:RELEASE.2025-09-07T16-13-09Z-cpuv1
    command: server /data
    volumes:
      - ./data/minio:/data
    environment:
      MINIO_ROOT_USER: minioautumn
      MINIO_ROOT_PASSWORD: minioautumn
      MINIO_DOMAIN: minio
    networks:
      default:
        aliases:
          - revolt-uploads.minio
          # legacy support:
          - attachments.minio
          - avatars.minio
          - backgrounds.minio
          - icons.minio
          - banners.minio
          - emojis.minio
    restart: always
  # Caddy: Web server
  caddy:
    image: docker.io/caddy
    restart: always
    env_file: .env.web
    ports:
      - "80:80"
      # - "443:443"
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile
      - ./data/caddy-data:/data
      - ./data/caddy-config:/config

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions