teddycloud icon indicating copy to clipboard operation
teddycloud copied to clipboard

Unable to Activate RTNL in the browser

Open P1tt187 opened this issue 10 months ago • 5 comments

I'm running teddycloud on kubernetes behind traefik.

The webui and the box connection works basicly. Now i tryied to activate RTNL Logging.

When i activate RTNL it tryes to access https://teddycloud.internal.org/api/sse I got a http 500 code with strict-origin-when-cross-origin

if i open a shell inside the container and run curl http://localhost/api/sse it works

I'm not sure if I have to set some header in the reverse proxy or if the tonicloud server has to provide a header in its response to make it work.

Can you please give me some advice?

P1tt187 avatar Jan 11 '25 00:01 P1tt187

This seems to be a setup related problem as a cross origin error occurs. What is the url you access the webfrontend of teddyCloud?

SciLor avatar Jan 11 '25 03:01 SciLor

Thanks for the reply.

i was able to create a docker compose file which can used to reproduce the error.

services:
  traefik:
    image: "traefik:latest"
    container_name: "traefik"
    #restart: unless-stopped
    command:
      - --api.insecure=true
      - --providers.docker
      - --entrypoints.web.address=:80
      - "--accesslog=true"
      - "--log.level=DEBUG"  
    ports:
      - 80:80  # optional
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
    labels:
      - "traefik.enable=true"
      
  teddycloud:
    container_name: teddycloud
    hostname: teddycloud
    image: ghcr.io/toniebox-reverse-engineering/teddycloud:latest
    # ports:
    #   - 80:80 #optional (for the webinterface)
    #   - 8443:8443 #optional (for the webinterface)
    #  - 443:443 #Port is needed for the connection for the box, must not be changed!
    volumes:
      - certs:/teddycloud/certs #certificates of the server
      - config:/teddycloud/config #config file for the server and the boxes
      - content:/teddycloud/data/content #microSD representation for the boxes
      - library:/teddycloud/data/library #library to manage content
      - custom_img:/teddycloud/data/www/custom_img #location to store custom images for custom tonies json
      - firmware:/teddycloud/data/firmware #firmware backups
      - cache:/teddycloud/data/cache #img cache for content images
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.teddycloud.rule=Host(`teddy.internal`)"
      - "traefik.http.routers.teddycloud.entrypoints=web"
      - "traefik.http.services.teddycloud.loadbalancer.server.port=80"  
#    restart: unless-stopped
volumes:
  certs:
  config:
  content:
  library:
  custom_img:
  firmware:
  cache:

curl -vvv http://teddy.internal/api/sse

output

21:49:39.050044 [0-x] == Info: [READ] client_reset, clear readers
21:49:39.057808 [0-0] == Info: Host teddy.internal:80 was resolved.
21:49:39.060372 [0-0] == Info: IPv6: (none)
21:49:39.062118 [0-0] == Info: IPv4: 192.168.178.38
21:49:39.064534 [0-0] == Info: [SETUP] added
21:49:39.066340 [0-0] == Info:   Trying 192.168.178.38:80...
21:49:39.069353 [0-0] == Info: Connected to teddy.internal (192.168.178.38) port 80
21:49:39.073054 [0-0] == Info: using HTTP/1.x
21:49:39.075112 [0-0] => Send header, 85 bytes (0x55)
0000: GET /api/sse HTTP/1.1
0017: Host: teddy.internal
002d: User-Agent: curl/8.11.0
0046: Accept: */*
0053:
21:49:39.083030 [0-0] <= Recv header, 36 bytes (0x24)
0000: HTTP/1.1 500 Internal Server Error
21:49:39.087752 [0-0] == Info: [WRITE] cw_out, wrote 36 header bytes -> 36
21:49:39.090490 [0-0] == Info: [WRITE] download_write header(type=c, blen=36) -> 0
21:49:39.094124 [0-0] == Info: [WRITE] client_write(type=c, len=36) -> 0
21:49:39.097399 [0-0] <= Recv header, 37 bytes (0x25)
0000: Date: Sat, 11 Jan 2025 20:49:39 GMT
21:49:39.101026 [0-0] == Info: [WRITE] header_collect pushed(type=1, len=37) -> 0
21:49:39.104470 [0-0] == Info: [WRITE] cw_out, wrote 37 header bytes -> 37
21:49:39.107811 [0-0] == Info: [WRITE] download_write header(type=4, blen=37) -> 0
21:49:39.110719 [0-0] == Info: [WRITE] client_write(type=4, len=37) -> 0
21:49:39.113418 [0-0] <= Recv header, 20 bytes (0x14)
0000: Content-Length: 21
21:49:39.117150 [0-0] == Info: [WRITE] header_collect pushed(type=1, len=20) -> 0
21:49:39.119989 [0-0] == Info: [WRITE] cw_out, wrote 20 header bytes -> 20
21:49:39.122356 [0-0] == Info: [WRITE] download_write header(type=4, blen=20) -> 0
21:49:39.125875 [0-0] == Info: [WRITE] client_write(type=4, len=20) -> 0
21:49:39.128309 [0-0] <= Recv header, 2 bytes (0x2)
0000:
21:49:39.130216 [0-0] == Info: [WRITE] header_collect pushed(type=1, len=2) -> 0
21:49:39.133037 [0-0] == Info: [WRITE] cw_out, wrote 2 header bytes -> 2
21:49:39.136719 [0-0] == Info: [WRITE] download_write header(type=4, blen=2) -> 0
21:49:39.139407 [0-0] == Info: [WRITE] client_write(type=4, len=2) -> 0
21:49:39.141766 [0-0] <= Recv data, 21 bytes (0x15)
0000: Internal Server Error
Internal Server Error21:49:39.144944 [0-0] == Info: [WRITE] cw_out, wrote 21 body bytes -> 21
21:49:39.148016 [0-0] == Info: [WRITE] download_write body(type=1, blen=21) -> 0
21:49:39.150723 [0-0] == Info: [WRITE] client_write(type=1, len=21) -> 0
21:49:39.153326 [0-0] == Info: [WRITE] xfer_write_resp(len=116, eos=0) -> 0
21:49:39.156754 [0-0] == Info: [WRITE] cw-out is notpaused
21:49:39.158753 [0-0] == Info: [WRITE] cw-out done
21:49:39.160382 [0-0] == Info: [READ] client_reset, clear readers
21:49:39.162508 [0-0] == Info: Connection #0 to host teddy.internal left intact

Traefik Output:

traefik     | 2025-01-11T20:49:39Z DBG github.com/traefik/traefik/v3/pkg/proxy/httputil/proxy.go:117 > 500 Internal Server Error error="net/http: HTTP/1.x transport connection broken: bad Content-Length \"18446744073709551615\""                                                                  
traefik     | 172.18.0.1 - - [11/Jan/2025:20:49:39 +0000] "GET /api/sse HTTP/1.1" 500 21 "-" "-" 22 "teddycloud@docker" "http://172.18.0.2:80" 0ms 

Could you please give it a try?

P1tt187 avatar Jan 11 '25 20:01 P1tt187

@SciLor: I think I found the problem and created a PR.

P1tt187 avatar Jan 12 '25 21:01 P1tt187

@SciLor i noticed that the code of my PR is not part of the latest release is there a problem with the fix or did i made anything wrong?

P1tt187 avatar Mar 06 '25 08:03 P1tt187

The problem was, that you targeted the master instead of the develop and I merged it. Please target the develop and try again

SciLor avatar Mar 06 '25 08:03 SciLor