4

Hello, I'm setting up Lemmy + Lemmy-UI + pict-rs on my k8s cluster. I've gotten all the components deployed, and I'm able to access the Lemmy and Lemmy-UI instances via local tunneling. However, I'm having trouble using Lemmy-UI to sign in or administer my instance.

I can successfully POST to /api/v3/user/login against the Lemmy API directly, but this same request fails when made in my browser through Lemmy-UI. Instead of rendering JSON, I receive an HTML "not found" page.

I also see this category of failure on other pages. For example, visiting http://localhost:lemmy-ui-port/communities in my browser makes a request to GET http://localhost:lemmy-ui-port/api/v3/community/list?type_=Local&sort=TopMonth&limit=50&page=1, which returns the Lemmy-UI 404 page rendered as HTML (The page you are looking for does not exist).

It seems like Lemmy-UI is failing to handle requests to /api endpoints properly and is not forwarding them along to the backend.

I've verified that Lemmy-UI can access Lemmy by shelling into the Lemmy-UI container and running these commands successfully:

wget $LEMMY_UI_LEMMY_INTERNAL_HOST
wget $LEMMY_UI_LEMMY_INTERNAL_HOST/api/v3/community/list

I've included both the successful and failing login requests below. Do you have any idea why I might be seeing this?


Making a login request against Lemmy:

POST /api/v3/user/login HTTP/1.1
Content-Type: application/json; charset=utf-8

{"username_or_email":"admin","password":"PASSWORD_GOES_HERE"}

HTTP/1.1 200 OK
content-type: application/json

{"jwt":"..."}

Making a login request through Lemmy-UI, just like the one I see in my browser's Network pane when I use the /login form:

POST /api/v3/user/login HTTP/1.1
Content-Type: application/json; charset=utf-8

{"username_or_email":"admin","password":"PASSWORD_GOES_HERE"}

HTTP/1.1 404 Not Found
Content-Type: text/html; charset=utf-8

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /api/v3/user/login</pre>
</body>
</html>
top 1 comments
sorted by: hot top controversial new old
[-] Max_P@lemmy.max-p.me 1 points 1 year ago

lemmy-ui doesn't proxy things to the backend for you, that's why the official Ansible/docker-compose use NGINX to direct any POST requests and Content-Type: application/activity+json as well as blanket sends some paths directly to the backend. See nginx_internal.conf

this post was submitted on 10 Jul 2023
4 points (100.0% liked)

Lemmy Support

4656 readers
1 users here now

Support / questions about Lemmy.

Matrix Space: #lemmy-space

founded 5 years ago
MODERATORS