gsmlg-dev / caddy-admin-ui

Caddy Admin UI written by next.js
34 stars 3 forks source link

errors trying to load frontend #2

Open till opened 1 year ago

till commented 1 year ago

I rebuilt caddy and added your module in. My Caddyfile looks like so:

{
    debug
    admin localhost:2021
}

{$ADMIN_UI_URL} {
    route {
        caddy_admin_ui
        reverse_proxy localhost:2021 {
            header_up Host localhost:2021
        }
    }
}

ADMIN_UI_URL is admin-ui.127.0.0.1.nip.io:80.

When I open the UI, only the header loads. I get a ton of these in the logs:

2023/05/21 09:58:05.456 ERROR   http.log.error  dial tcp 127.0.0.1:2021: connect: connection refused    {"request": {"remote_ip": "172.17.0.1", "remote_port": "40452", "proto": "HTTP/1.1", "method": "GET", "host": "admin-ui.127.0.0.1.nip.io", "uri": "/config/", "headers": {"Accept": ["*/*"], "Accept-Language": ["en-GB,en;q=0.7"], "Accept-Encoding": ["gzip, deflate"], "Connection": ["keep-alive"], "Authorization": [], "User-Agent": ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"], "Sec-Gpc": ["1"], "Referer": ["http://admin-ui.127.0.0.1.nip.io/setup"]}}, "duration": 0.002439644, "status": 502, "err_id": "2d274zhqu", "err_trace": "reverseproxy.statusError (reverseproxy.go:1299)"}
2023/05/21 09:58:05.537 DEBUG   http.handlers.caddy_admin_ui    sanitized path join {"request_path": "/worker-json.js", "result": "build/worker-json.js"}
2023/05/21 09:58:05.537 DEBUG   http.handlers.caddy_admin_ui    filename is not exists, try to find with index and suffix   {"error": "open build/worker-json.js: file does not exist", "filename": "build/worker-json.js", "File": "<nil>", "FileSystem": "{0x21f2140}"}
2023/05/21 09:58:05.537 DEBUG   http.handlers.caddy_admin_ui    open file error {"error": "open build/worker-json.js.md: file does not exist", "File": "<nil>", "FileSystem": "{0x21f2140}"}
2023/05/21 09:58:05.537 DEBUG   http.handlers.reverse_proxy selected upstream   {"dial": "localhost:2021", "total_upstreams": 1}
2023/05/21 09:58:05.538 DEBUG   http.handlers.reverse_proxy upstream roundtrip  {"upstream": "localhost:2021", "duration": 0.000455051, "request": {"remote_ip": "172.17.0.1", "remote_port": "40438", "proto": "HTTP/1.1", "method": "GET", "host": "localhost:2021", "uri": "/worker-json.js", "headers": {"X-Forwarded-For": ["172.17.0.1"], "Accept-Language": ["en-GB,en;q=0.7"], "Authorization": [], "Accept-Encoding": ["gzip, deflate"], "X-Forwarded-Host": ["admin-ui.127.0.0.1.nip.io"], "Sec-Gpc": ["1"], "User-Agent": ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"], "X-Forwarded-Proto": ["http"], "Accept": ["*/*"]}}, "error": "dial tcp 127.0.0.1:2021: connect: connection refused"}
2023/05/21 09:58:05.538 ERROR   http.log.error  dial tcp 127.0.0.1:2021: connect: connection refused    {"request": {"remote_ip": "172.17.0.1", "remote_port": "40438", "proto": "HTTP/1.1", "method": "GET", "host": "admin-ui.127.0.0.1.nip.io", "uri": "/worker-json.js", "headers": {"Accept-Encoding": ["gzip, deflate"], "Connection": ["keep-alive"], "Authorization": [], "User-Agent": ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"], "Accept": ["*/*"], "Sec-Gpc": ["1"], "Accept-Language": ["en-GB,en;q=0.7"]}}, "duration": 0.001296578, "status": 502, "err_id": "i2unaum5e", "err_trace": "reverseproxy.statusError (reverseproxy.go:1299)

I wanted to have a look how the frontend works, but it seems like there's only the build result in the repository?

till commented 1 year ago

I wanted to have a look how the frontend works, but it seems like there's only the build result in the repository?

I had to look harder: https://github.com/gsmlg-dev/caddy-admin-ui/tree/dev

gsmlg commented 1 year ago

I wanted to have a look how the frontend works, but it seems like there's only the build result in the repository?

I had to look harder: https://github.com/gsmlg-dev/caddy-admin-ui/tree/dev

This repo is built with Next.js and embedded in Caddy as a directive.

You can take a look at the Github workflow and see how it is built.

till commented 1 year ago

Any idea why I would get connection refused from the API endpoint?

gsmlg commented 1 year ago

Any idea why I would get connection refused from the API endpoint?

Maybe host name does not match