[GH-ISSUE #2888] 3x-UI API. #1925

Closed
opened 2026-10-31 20:22:01 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @shabievvusal on GitHub (Apr 11, 2025).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/2888

I'm trying to log in via the command line to create a telegram bot later. I can't do anything, I tried to fix the problem, even installed nginx. added --http0.9, but it doesn't help

> POST /baku/panel/api/inbounds/addClient HTTP/1.1
> Host: 127.0.0.1:2053
> User-Agent: curl/8.5.0
> Accept: application/json
> Content-Type: application/json
> Content-Length: 257
>
* Received HTTP/0.9 when not allowed
* Closing connection
curl: (1) Received HTTP/0.9 when not allowed```
Originally created by @shabievvusal on GitHub (Apr 11, 2025). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/2888 I'm trying to log in via the command line to create a telegram bot later. I can't do anything, I tried to fix the problem, even installed nginx. added --http0.9, but it doesn't help ```* Connected to 127.0.0.1 (127.0.0.1) port 2053 > POST /baku/panel/api/inbounds/addClient HTTP/1.1 > Host: 127.0.0.1:2053 > User-Agent: curl/8.5.0 > Accept: application/json > Content-Type: application/json > Content-Length: 257 > * Received HTTP/0.9 when not allowed * Closing connection curl: (1) Received HTTP/0.9 when not allowed```
bsakaguchi 2026-10-31 20:22:01 +07:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@voronin9032 commented on GitHub (Apr 15, 2025):

What command do you use to log in?

I just checked the API in latest 3X-UI on a new installation with default settings and it works perfectly fine.

My commands:

$ # Start the panel
$ docker compose up -d
$
$ # Obtain the cookie
$ curl -i -X POST -H "Content-Type: application/json" -d '{ "username": "admin", "password": "admin" }' localhost:2053/login
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Set-Cookie: 3x-ui=MTc0NDczODIxMnxEWDhFQVFMX2dBQUJFQUVRQUFCMV80QUFBUVp6ZEhKcGJtY01EQUFLVEU5SFNVNWZWVk5GVWhoNExYVnBMMlJoZEdGaVlYTmxMMjF2WkdWc0xsVnpaWExfZ1FNQkFRUlZjMlZ5QWYtQ0FBRUVBUUpKWkFFRUFBRUlWWE5sY201aGJXVUJEQUFCQ0ZCaGMzTjNiM0prQVF3QUFRdE1iMmRwYmxObFkzSmxkQUVNQUFBQUZQLUNFUUVDQVFWaFpHMXBiZ0VGWVdSdGFXNEF8nZqcOXvxyy5HRlpyXi1dWP7DUuzbITI1xM80_X8KHhU=; Path=/; Expires=Tue, 15 Apr 2025 18:30:12 GMT; Max-Age=3600; HttpOnly
Date: Tue, 15 Apr 2025 17:30:12 GMT
Content-Length: 54

{"success":true,"msg":"Login Successfully","obj":null}
$
$ # Use obtained cookie for API requests
$ curl -i -H "Cookie: 3x-ui=MTc0NDczODIxMnxEWDhFQVFMX2dBQUJFQUVRQUFCMV80QUFBUVp6ZEhKcGJtY01EQUFLVEU5SFNVNWZWVk5GVWhoNExYVnBMMlJoZEdGaVlYTmxMMjF2WkdWc0xsVnpaWExfZ1FNQkFRUlZjMlZ5QWYtQ0FBRUVBUUpKWkFFRUFBRUlWWE5sY201aGJXVUJEQUFCQ0ZCaGMzTjNiM0prQVF3QUFRdE1iMmRwYmxObFkzSmxkQUVNQUFBQUZQLUNFUUVDQVFWaFpHMXBiZ0VGWVdSdGFXNEF8nZqcOXvxyy5HRlpyXi1dWP7DUuzbITI1xM80_X8KHhU=" localhost:2053/panel/api/inbounds/list
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 15 Apr 2025 17:31:25 GMT
Content-Length: 34

{"success":true,"msg":"","obj":[]}
$

docker-compose.yaml (official):

services:
  3x-ui:
    image: ghcr.io/mhsanaei/3x-ui:latest
    container_name: 3x-ui
    hostname: yourhostname
    volumes:
      - $PWD/db/:/etc/x-ui/
      - $PWD/cert/:/root/cert/
    environment:
      XRAY_VMESS_AEAD_FORCED: "false"
      X_UI_ENABLE_FAIL2BAN: "true"
    tty: true
    network_mode: host
    restart: unless-stopped
<!-- gh-comment-id:2807011918 --> @voronin9032 commented on GitHub (Apr 15, 2025): What command do you use to log in? I just checked the API in latest 3X-UI on a new installation with default settings and it works perfectly fine. My commands: ```bash $ # Start the panel $ docker compose up -d $ $ # Obtain the cookie $ curl -i -X POST -H "Content-Type: application/json" -d '{ "username": "admin", "password": "admin" }' localhost:2053/login HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 Set-Cookie: 3x-ui=MTc0NDczODIxMnxEWDhFQVFMX2dBQUJFQUVRQUFCMV80QUFBUVp6ZEhKcGJtY01EQUFLVEU5SFNVNWZWVk5GVWhoNExYVnBMMlJoZEdGaVlYTmxMMjF2WkdWc0xsVnpaWExfZ1FNQkFRUlZjMlZ5QWYtQ0FBRUVBUUpKWkFFRUFBRUlWWE5sY201aGJXVUJEQUFCQ0ZCaGMzTjNiM0prQVF3QUFRdE1iMmRwYmxObFkzSmxkQUVNQUFBQUZQLUNFUUVDQVFWaFpHMXBiZ0VGWVdSdGFXNEF8nZqcOXvxyy5HRlpyXi1dWP7DUuzbITI1xM80_X8KHhU=; Path=/; Expires=Tue, 15 Apr 2025 18:30:12 GMT; Max-Age=3600; HttpOnly Date: Tue, 15 Apr 2025 17:30:12 GMT Content-Length: 54 {"success":true,"msg":"Login Successfully","obj":null} $ $ # Use obtained cookie for API requests $ curl -i -H "Cookie: 3x-ui=MTc0NDczODIxMnxEWDhFQVFMX2dBQUJFQUVRQUFCMV80QUFBUVp6ZEhKcGJtY01EQUFLVEU5SFNVNWZWVk5GVWhoNExYVnBMMlJoZEdGaVlYTmxMMjF2WkdWc0xsVnpaWExfZ1FNQkFRUlZjMlZ5QWYtQ0FBRUVBUUpKWkFFRUFBRUlWWE5sY201aGJXVUJEQUFCQ0ZCaGMzTjNiM0prQVF3QUFRdE1iMmRwYmxObFkzSmxkQUVNQUFBQUZQLUNFUUVDQVFWaFpHMXBiZ0VGWVdSdGFXNEF8nZqcOXvxyy5HRlpyXi1dWP7DUuzbITI1xM80_X8KHhU=" localhost:2053/panel/api/inbounds/list HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 Date: Tue, 15 Apr 2025 17:31:25 GMT Content-Length: 34 {"success":true,"msg":"","obj":[]} $ ``` docker-compose.yaml (official): ``` services: 3x-ui: image: ghcr.io/mhsanaei/3x-ui:latest container_name: 3x-ui hostname: yourhostname volumes: - $PWD/db/:/etc/x-ui/ - $PWD/cert/:/root/cert/ environment: XRAY_VMESS_AEAD_FORCED: "false" X_UI_ENABLE_FAIL2BAN: "true" tty: true network_mode: host restart: unless-stopped ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#1925
No description provided.