silverwind / droppy

**ARCHIVED** Self-hosted file storage
BSD 2-Clause "Simplified" License
1.62k stars 195 forks source link

nginx reverse proxy websocket #447

Open antoinebou12 opened 3 years ago

antoinebou12 commented 3 years ago

I want to use droppy with my reverse proxy in nginx but I get a websocket error, but not when I use the direct IP and port

client.js:27 WebSocket connection to 'ws://droppy.domain.com/!/socket' failed: Error during WebSocket handshake: Unexpected response code: 307

nginx config file

events {
}
http {
  server {
      listen 80;
      server_name droppy.domain.com;
      access_log /var/log/nginx/droppy.log;
      error_log /var/log/nginx/droppy-error.log;
      location / {
          proxy_pass http://ip:8989;
      }
  }
}

droppy conf

{
  "listeners": [
    {
      "host": [
        "0.0.0.0",
        "::"
      ],
      "port": 8989,
      "socket": "/tmp/droppy",
      "protocol": "http"
    }
  ],
  "public": true,
  "timestamps": true,
  "linkLength": 5,
  "linkExtensions": false,
  "logLevel": 2,
  "maxFileSize": 0,
  "updateInterval": 1000,
  "pollingInterval": 0,
  "keepAlive": 20000,
  "uploadTimeout": 604800000,
  "allowFrame": false,
  "readOnly": false,
  "ignorePatterns": [],
  "watch": true,
  "headers": {}
}

docker

version: '3.7'
services:
  droppy:
    container_name: droppy
    image: silverwind/droppy
    environment:
      - UID=1000
      - GID=1000
    ports:
      - '8989:8989'
    volumes:
      - /mnt/sdb/droppy/config:/config
      - /mnt/sdb/droppy/data:/files
    restart: unless-stopped