bug: UNKOWNERROR : /api/auth/login 404 CODE #71

Closed
opened 2026-02-16 12:51:19 -05:00 by yindo · 1 comment
Owner

Originally created by @anioji on GitHub (Sep 28, 2024).

What happened?

When i try register/login API-Server sending me 404 code

Error
Screenshot from 2024-09-28 18-36-13

Client

/api/auth/session/login
Status 404
Version HTTP/2

API

api_1            |  INFO  rocket::server                                                   > POST /api/auth/session/login application/json:
api_1            |  ERROR _                                                                > No matching routes for POST /api/auth/session/login application/json.
api_1            |  WARN  _                                                                > No 404 catcher registered. Using Rocket default.
api_1            |  INFO  _                                                                > Response succeeded.

Dot ENV

# Hostname used for Caddy
# This should in most cases match REVOLT_APP_URL
HOSTNAME=https://revolt.my_domain.com

# URL to where the Revolt app is publicly accessible
REVOLT_APP_URL=https://revolt.my_domain.com

# URL to where the API is publicly accessible
REVOLT_PUBLIC_URL=https://revolt.dimitrash.pro/api
VITE_API_URL=https://revolt.my_domain.com/api

# URL to where the WebSocket server is publicly accessible
REVOLT_EXTERNAL_WS_URL=wss://revolt.my_domain.com/ws

# URL to where Autumn is publicly available
AUTUMN_PUBLIC_URL=https://revolt.my_domain.com/autumn

# URL to where January is publicly available
JANUARY_PUBLIC_URL=https://revolt.my_domain.com/january

Revolt.toml

app = "https://revolt.my_domain.com"
api = "https://revolt.my_domain.com/api"
events = "wss://revolt.my_domain.com/ws"
autumn = "https://revolt.my_domain.com/autumn"
january = "https://revolt.my_domain.com/january"

NGINX?!?!

Interdiction

I ignore Caddy - proxy because in my network with more self-hosted services entry point is nginx.
Caddy send 301 when nginx proxing req on http
If write https://... we get 502 code ... Nginx cant proxy to https services

Client -> Nginx -> Caddy -> 301 https://revolt.my_domain.com -> Nginx -> Client -> Nginx -> Caddy -> 301 https://revolt.my_domain.com ... Cycle

Settings

I opened ports in docker-compose and add to /etc/hosts local-address of my VM in my ingress server

server {
        listen 443;
        server_name revolt.my_domain.com;

        ssl_certificate /etc/nginx/certs/my_domain.com.crt;
        ssl_certificate_key /etc/nginx/certs/my_domain.com.key;

        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;

        location / {
                proxy_pass http://revolt.my_domain.com:83/;
        }
        location /api {
                proxy_pass http://revolt.my_domain.com:81/api;
        }

        location /autumn {
                proxy_pass http://revolt.my_domain.com:84/autumn;
        }

        location /january {
                proxy_pass http://revolt.dimitrash.pro:85/january;
        }

        location /ws {
                proxy_pass http://revolt.my_domain.com:82/ws;
                proxy_http_version 1.1;
                proxy_set_header Upgrade "websocket";
                proxy_set_header Connection "Upgrade";
        }
}
Originally created by @anioji on GitHub (Sep 28, 2024). ### What happened? When i try register/login API-Server sending me 404 code Error ![Screenshot from 2024-09-28 18-36-13](https://github.com/user-attachments/assets/f380e493-64a3-4d7c-a2d6-6d968c87ea3d) **Client** ```yaml /api/auth/session/login Status 404 Version HTTP/2 ``` **API** ```yaml api_1 | INFO rocket::server > POST /api/auth/session/login application/json: api_1 | ERROR _ > No matching routes for POST /api/auth/session/login application/json. api_1 | WARN _ > No 404 catcher registered. Using Rocket default. api_1 | INFO _ > Response succeeded. ``` **Dot ENV** ```env # Hostname used for Caddy # This should in most cases match REVOLT_APP_URL HOSTNAME=https://revolt.my_domain.com # URL to where the Revolt app is publicly accessible REVOLT_APP_URL=https://revolt.my_domain.com # URL to where the API is publicly accessible REVOLT_PUBLIC_URL=https://revolt.dimitrash.pro/api VITE_API_URL=https://revolt.my_domain.com/api # URL to where the WebSocket server is publicly accessible REVOLT_EXTERNAL_WS_URL=wss://revolt.my_domain.com/ws # URL to where Autumn is publicly available AUTUMN_PUBLIC_URL=https://revolt.my_domain.com/autumn # URL to where January is publicly available JANUARY_PUBLIC_URL=https://revolt.my_domain.com/january ``` **Revolt.toml** ```toml app = "https://revolt.my_domain.com" api = "https://revolt.my_domain.com/api" events = "wss://revolt.my_domain.com/ws" autumn = "https://revolt.my_domain.com/autumn" january = "https://revolt.my_domain.com/january" ``` **NGINX?!?!** __Interdiction__ I ignore Caddy - proxy because in my network with more self-hosted services entry point is nginx. Caddy send 301 when nginx proxing req on http If write https://... we get 502 code ... Nginx cant proxy to https services Client -> Nginx -> Caddy -> 301 https://revolt.my_domain.com -> Nginx -> Client -> Nginx -> Caddy -> 301 https://revolt.my_domain.com ... Cycle __Settings__ I opened ports in docker-compose and add to /etc/hosts local-address of my VM in my ingress server ```nginx server { listen 443; server_name revolt.my_domain.com; ssl_certificate /etc/nginx/certs/my_domain.com.crt; ssl_certificate_key /etc/nginx/certs/my_domain.com.key; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; location / { proxy_pass http://revolt.my_domain.com:83/; } location /api { proxy_pass http://revolt.my_domain.com:81/api; } location /autumn { proxy_pass http://revolt.my_domain.com:84/autumn; } location /january { proxy_pass http://revolt.dimitrash.pro:85/january; } location /ws { proxy_pass http://revolt.my_domain.com:82/ws; proxy_http_version 1.1; proxy_set_header Upgrade "websocket"; proxy_set_header Connection "Upgrade"; } } ```
yindo added the bug label 2026-02-16 12:51:19 -05:00
yindo closed this issue 2026-02-16 12:51:19 -05:00
Author
Owner

@insertish commented on GitHub (Sep 29, 2024):

You need to strip the /api prefix when passing requests to the proxy.
See https://github.com/revoltchat/self-hosted/blob/master/Caddyfile#L3.

(I don't know how nginx handles this but I can see in your logs that it is not stripping the path.)

@insertish commented on GitHub (Sep 29, 2024): You need to strip the `/api` prefix when passing requests to the proxy. See https://github.com/revoltchat/self-hosted/blob/master/Caddyfile#L3. (I don't know how nginx handles this but I can see in your logs that it is not stripping the path.)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: stoatchat/self-hosted#71