self-hosted icon indicating copy to clipboard operation
self-hosted copied to clipboard

bug: Autumn File Upload Issue Please Help me

Open YoussefRefaat1976 opened this issue 7 months ago • 2 comments

What happened?

I have an issue while uploading a file,photo only text works let me show you here my files:

Cadddyfile `www.MyDOMAIN.com, MyDOMAIN.com { tls [email protected]

@api path /api*
handle @api {
    uri strip_prefix /api
    reverse_proxy http://api:14702
}

@ws path /ws*
handle @ws {
    uri strip_prefix /ws
    reverse_proxy http://events:14703
}

@autumn path /autumn*
handle @autumn {
    uri strip_prefix /autumn
    reverse_proxy http://autumn:14704 {
        header_up Authorization {>Authorization}
    }
}
@january path /january*
handle @january {
    uri strip_prefix /january
    reverse_proxy http://january:14705
}

handle {
    root * /var/www/revolt-frontend
    try_files {path} /index.html
    file_server
}

} `

Revolt.toml [hosts] app = "https://www.MYDOMAIN.com" api = "https://www.MYDOMAIN.com/api" events = "wss://www.MYDOMAIN.com/ws" autumn = "https://www.MYDOMAIN.com/autumn" january = "https://www.MYDOMAIN.com/january" also I'm thinking if may be a problem with the private_key, Public key! but...

LET ME SHOW YOU THE CONSOLE WHEN I TRY TO UPLOAD A FILE:

`GET https://www.MYDOMAIN.com/ [HTTP/2 304 236ms]

GET wss://www.MYDOMAIN.com/ws

GET https://www.MYDOMAIN.com/assets/main.1468d6bd.js [HTTP/2 200 0ms]

GET https://www.MYDOMAIN.com/assets/vendor.53ae3162.js [HTTP/2 200 0ms]

XHRGET https://www.MYDOMAIN.com/api/release [HTTP/2 404 318ms]

GET https://www.MYDOMAIN.com/assets/call_join.584596d3.mp3 [HTTP/2 206 0ms]

GET https://www.MYDOMAIN.com/assets/message.1da7350f.mp3 [HTTP/2 206 0ms]

GET https://www.MYDOMAIN.com/assets/call_leave.73de5878.mp3 [HTTP/2 206 0ms]

Uncaught (in promise) SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

GET wss://www.MYDOMAIN.com/ws [HTTP/1.1 101 Switching Protocols 1093ms]

GET https://www.MYDOMAIN.com/assets/apple-touch.8a2f0789.png [HTTP/2 200 0ms]

GET https://www.MYDOMAIN.com/assets/logo_round.png [HTTP/2 200 0ms]

GET https://www.MYDOMAIN.com/assets/RevoltApp.d4dd4107.js [HTTP/2 200 0ms]

GET https://www.MYDOMAIN.com/assets/Titlebar.84573465.js [HTTP/2 200 0ms]

GET https://www.MYDOMAIN.com/assets/placeholder.a8e8f04f.svg [HTTP/1.1 200 OK 0ms]

GET https://www.MYDOMAIN.com/assets/wide.svg [HTTP/1.1 200 OK 0ms]

GET https://www.MYDOMAIN.com/api/users/01JV7SD0C15NZ3YCYEE46JYNJB/default_avatar [HTTP/1.1 200 OK 0ms]

GET https://www.MYDOMAIN.com/assets/open-sans-latin-500-normal.c64e196f.woff2 [HTTP/2 200 0ms]

GET https://www.MYDOMAIN.com/assets/Renderer.4d4cd083.js [HTTP/2 200 0ms]

GET https://www.MYDOMAIN.com/assets/Renderer.1faefc04.css [HTTP/2 200 0ms]

GET https://www.MYDOMAIN.com/assets/open-sans-latin-400-italic.f27408b0.woff2 [HTTP/2 200 0ms]

XHRPOST https://www.MYDOMAIN.com/autumn/attachments [HTTP/2 401 291ms] `

my compose.yml `name: revolt

services:

MongoDB: Database

database: image: docker.io/mongo restart: always volumes: - ./data/db:/data/db healthcheck: test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet interval: 10s timeout: 10s retries: 5 start_period: 10s

Redis: Event message broker & KV store

redis: image: docker.io/eqalpha/keydb restart: always

RabbitMQ: Internal message broker

rabbit: image: docker.io/rabbitmq:4 restart: always environment: RABBITMQ_DEFAULT_USER: rabbituser RABBITMQ_DEFAULT_PASS: rabbitpass volumes: - ./data/rabbit:/var/lib/rabbitmq healthcheck: test: rabbitmq-diagnostics -q ping interval: 10s timeout: 10s retries: 3 start_period: 20s

MinIO: S3-compatible storage server

minio: image: docker.io/minio/minio 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 # <<< ADD THIS LINE >>> - /var/www/revolt-frontend:/var/www/revolt-frontend:ro

API server

api: image: ghcr.io/revoltchat/server:20250210-1 depends_on: database: condition: service_healthy redis: condition: service_started rabbit: condition: service_healthy volumes: - type: bind source: ./Revolt.toml target: /Revolt.toml restart: always

Events service

events: image: ghcr.io/revoltchat/bonfire:20250210-1 depends_on: database: condition: service_healthy redis: condition: service_started volumes: - type: bind source: ./Revolt.toml target: /Revolt.toml restart: always

Web App

web: image: ghcr.io/revoltchat/client:master restart: always env_file: .env.web

File server

autumn: image: ghcr.io/revoltchat/autumn:20250210-1 depends_on: database: condition: service_healthy createbuckets: condition: service_started volumes: - type: bind source: ./Revolt.toml target: /Revolt.toml restart: always

Metadata and image proxy

january: image: ghcr.io/revoltchat/january:20250210-1 volumes: - type: bind source: ./Revolt.toml target: /Revolt.toml restart: always

Regular task daemon

crond: image: ghcr.io/revoltchat/crond:20250210-1-debug depends_on: database: condition: service_healthy minio: condition: service_started volumes: - type: bind source: ./Revolt.toml target: /Revolt.toml restart: always

Push notification daemon

pushd: image: ghcr.io/revoltchat/pushd:20250210-1 depends_on: database: condition: service_healthy redis: condition: service_started rabbit: condition: service_healthy volumes: - type: bind source: ./Revolt.toml target: /Revolt.toml restart: always

Create buckets for minio.

createbuckets: image: docker.io/minio/mc depends_on: - minio entrypoint: > /bin/sh -c " while ! /usr/bin/mc ready minio; do /usr/bin/mc config host add minio http://minio:9000 minioautumn minioautumn; echo 'Waiting minio...' && sleep 1; done; /usr/bin/mc mb minio/revolt-uploads; exit 0; " `

YoussefRefaat1976 avatar Jun 01 '25 10:06 YoussefRefaat1976

I'm trying to fix the issue using CHATGPT for more than 2 weeks, it was working with the file uploading, but after a lot of edits and saving backups without testing all services, including file upload, so I guess I did something. I'm not sure what it is, so I will be very happy if someone helps

YoussefRefaat1976 avatar Jun 01 '25 10:06 YoussefRefaat1976

If you use a codeblock, you can post a file without it getting... interesting formatting.

{$HOSTNAME} {
	route /api* {
		uri strip_prefix /api
		reverse_proxy http://api:14702 {
			header_down Location "^/" "/api/"
		}
	}

	route /ws {
		uri strip_prefix /ws
		reverse_proxy http://events:14703 {
			header_down Location "^/" "/ws/"
		}
	}

	route /autumn* {
		uri strip_prefix /autumn
		reverse_proxy http://autumn:14704 {
			header_down Location "^/" "/autumn/"
		}
	}

	route /january* {
		uri strip_prefix /january
		reverse_proxy http://january:14705 {
			header_down Location "^/" "/january/"
		}
	}

	reverse_proxy http://web:5000
}

It's like this:

``` code block here ```

Gets you:

code block
here

And then for your problem, you've got a line in Caddyfile like header_up Authorization {>Authorization} which seems weird to me

XHRPOST
https://www.mydomain.com/autumn/attachments
[HTTP/2 401 291ms]

That 401 response is complaining about Authorization. I guess you could ask chatgpt about the line, I know that a conventional search engine wont really be useful for getting an explaination of a line that includes a greater than character as the main thing to look into.

Docteh avatar Jun 05 '25 20:06 Docteh