Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
anioji opened this issue Sep 28, 2024 · 1 comment
Closed

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

anioji opened this issue Sep 28, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@anioji
Copy link

anioji commented 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";
        }
}
@anioji anioji added the bug Something isn't working label Sep 28, 2024
@github-project-automation github-project-automation bot moved this to 🆕 Untriaged in Revolt Project Sep 28, 2024
@insertish
Copy link
Member

insertish commented 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.)

@github-project-automation github-project-automation bot moved this from 🆕 Untriaged to ✅ Done in Revolt Project Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

2 participants