Trouble with @id

I have a rather complex caddy file. I want to have a sill static site - that I can then replace later with a reverse proxy to a docker container.

I added the @id tag in the config to mark the part of the config I want to change.

I can get the config no problem:

curl http://localhost:2019/id/kibana
{"@id":"kibana","handle":[{"body":"Kibana not running - run \"launch_kibana\"\n","handler":"static_response","status_code":501}],"match":[{"host":[""]}],"terminal":true}

I now want to replace the “handle” element with a reverse proxy handler. However, I have been unable to make the right JSON to make this work. Anyone have any ideas?

This is what I’m currently trying:

JSON_STRING=$( jq -n \
        --arg khost "${HOSTNAME}:5601" \
        --arg chost "kibana.${HOSTNAME}" \
        '{"handler":"subroute","routes":[{"handle":null}]},{"handler":"reverse_proxy","upstreams":[{"dial": $khost }]}' )

curl -s -X POST -H "Content-Type: application/json" \
        -d  "$JSON_STRING" \

I think you’re looking to use either PUT or PATCH, not POST. See the API docs.

This topic was automatically closed after 30 days. New replies are no longer allowed.