abiosoft / caddy-docker

Docker container for Caddy
https://hub.docker.com/r/abiosoft/caddy/
MIT License
766 stars 314 forks source link

access caddy admin /config #252

Closed japrogramer closed 4 years ago

japrogramer commented 4 years ago

Can't access admin

run: loading initial config: loading new config: http app module: start: tcp: listening on :2019: listen tcp :2019: bind: address already in use
{"level":"info","ts":1592205213.4369204,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
{"level":"info","ts":1592205213.4729564,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["localhost:2019","[::1]:2019","127.0.0.1:2019"]}
2020/06/15 07:13:33 [INFO][cache:0xc0006e0190] Started certificate maintenance routine
{"level":"info","ts":1592205213.4734793,"logger":"http","msg":"server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server","server_name":"srv1","http_port":80}
{"level":"info","ts":1592205213.4735527,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv2"}
{"level":"warn","ts":1592205213.473591,"logger":"http","msg":"user server is listening on same interface as automatic HTTP->HTTPS redirects; user-configured routes might override these redirects","server_name":"srv1","interface":"tcp/:80"}
{"level":"info","ts":1592205213.4740198,"logger":"tls","msg":"cleaned up storage units"}
run: loading initial config: loading new config: http app module: start: tcp: listening on :2019: listen tcp :2019: bind: address already in use
  caddy:
    image: caddy:2.0.0-alpine
    depends_on:
    - "graphql-engine"
    restart: always
    ports:
    - "80:80"
    - "443:443"
    - "2019:2019"
    volumes:
    - ./Caddy/local-Caddyfile:/etc/caddy/Caddyfile
    - caddy_certs:/root/.caddy
:2019 {
    reverse_proxy / localhost:2019 {
    }
}
abiosoft commented 4 years ago

Kindly stop recreating this issue. It has been addressed here https://github.com/abiosoft/caddy-docker/issues/251

japrogramer commented 4 years ago

I did upgrade to caddy 2 as this post shows. still can't use admin.

made new issue because #251 was closed and was about v1 this time it's about v2

japrogramer commented 4 years ago

Managed to connect to the admin but im getting this error,

{"level":"error","ts":1592287487.6628766,"logger":"admin.api","msg":"request error","error":"host not allowed: 127.0.0.1:2015","status_code":403}

when I try to get the url from inside the container i get this

{"level":"info","ts":1592287479.9517336,"logger":"admin.api","msg":"received request","method":"GET","host":"127.0.0.1:2019","uri":"/config/","remote_addr":"127.0.0.1:52946","headers":{"Accept":["*/*"],"User-Agent":["curl/7.67.0"]}}

config log is

{"level":"info","ts":1592285768.9544978,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["localhost:2019","[::1]:2019","127.0.0.1:2019"]}

I can't use 2019 in the caddyfile because that port is already in use. enforce_origins seems to be too strict.

chengguangnan commented 6 days ago

I'm having the same problem.