INFO admin admin endpoint started {"address": "tcp/127.0.0.1:2019", "enforce_origin": false, "origins": ["http://localhost:2019"]}
Uncomment enforce_origin
caddy reload
Note that this reload worked
caddy reload
reload: sending configuration to instance: caddy responded with error: HTTP 403: {"error":"client is not allowed to access from origin 'localhost:2019'"}
caddy log:
ERROR admin.api request error {"error": "client is not allowed to access from origin 'localhost:2019'", "status_code": 403}
Is this a:
bug in enforce_origin?
caddy reload isn’t sending admin the correct (origin) headers?
On it, but since you’re here, I also want to run sockets by you:
admin unix//tmp/http.sock {
origins "dummy" # I probably got this wrong! Please let me know a more realistic one that will appear in the real world
enforce_origin
}
access:
curl --unix-socket /tmp/http.sock -X GET -H'Content-Type: application/json' -H'Origin: dummy' https://dummy/config/
curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number
curl --unix-socket /tmp/http.sock -X GET -H'Content-Type: application/json' -H'Origin: dummy' http://dummy/config/
{"error":"client is not allowed to access from origin 'dummy'"}
curl --unix-socket /tmp/http.sock -X GET -H'Content-Type: application/json' -H'Origin: dummy' dummy/config/
{"error":"client is not allowed to access from origin 'dummy'"}
Ah yeah, sockets are tricky; we have special handling for that and I’m currently working on something else so I need to find time to check, but I believe enforcing Origin on a unix socket doesn’t make much sense if I recall correctly, can you even connect to a unix socket from a browser page?