Having issues with Admin port (:2019)

1. The problem I’m having:

We are using the admin port (2019) to create dynamic routes. After the latest update, this stopped working.

2. Error messages and/or full log output:

After a reboot:
curl localhost:2019/config/

{"error":"host not allowed: localhost:2019"}

But, restart the service:
$ sudo systemctl restart caddy
$ curl localhost:2019/config/


This now works for reading, but when trying to update and make changes via the API port, you get:

connect ECONNREFUSED ::1:2019


From the Journal:

Jun 18 08:34:47 pop-os caddy[404079]: {"level":"info","ts":1718721287.4569757,"logger":"admin.api","msg":"received request","method":"GET","host":"localhost:2019","uri":"/config/","remote_ip":"","remote_port":"45120","headers":{"Accept":["*/*"],"User-Agent":["curl/7.81.0"]}}

So, a “GET” on port 2019 works, but a “POST” gets a connection refused.

3. Caddy version:

$ caddy version
v2.8.4 h1:q3pe0wpBj1OcHFZ3n/1nl4V4bxBrYoSoab7rL9BMYNk=

4. How I installed and ran Caddy:

a. System environment:


b. Command:

c. Service/unit/compose file:

d. My complete Caddy config:

	# This is pointing to Let's Encrypt Staging environment (for dev)
	# https://letsencrypt.org/docs/staging-environment/
	# This will allow you to get things right before issuing trusted
	# certificates and reduce the chance of your running up against rate limits.
	# acme_ca https://acme-staging-v02.api.letsencrypt.org/directory

	# causes all certificates to be issued internally by default,
	# rather than through a (public) ACME CA such as Let's Encrypt.
	# This is useful in development environments.

	# configure automatic HTTPS. It can either disable it entirely (off)
	# or disable only HTTP-to-HTTPS redirects (disable_redirects).
	auto_https off


# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile

(header_options) {
	header_up X-Real-IP {remote_host}
	header_up Access-Control-Allow-Origin *
	header_up Access-Control-Allow-Credentials true
	header_up Access-Control-Allow-Headers Cache-Control,Content-Type

localhost:80 {
	# bind :80

	# serve photography folder
	root /files/* /opt/ivt/photography

	# Set this path to your site's directory.
	root * /opt/ivt/apps/6.5.0/packages/client/spa

	# Enable the static file server.

	route /weather/* {
		uri replace /weather /socket.io
		reverse_proxy * http://localhost:3010 {
			import header_options
	route /ptz/* {
		uri replace /ptz /socket.io
		reverse_proxy * http://localhost:3006 {
			import header_options
	route /liveview/* {
		uri replace /liveview /socket.io
		reverse_proxy * http://localhost:3004 {
			import header_options
	route /archive/* {
		uri replace /archive /socket.io
		reverse_proxy * http://localhost:3003 {
			import header_options
	route /alarms/* {
		uri replace /alarms /socket.io
		reverse_proxy * http://localhost:3002 {
			import header_options
	route /console_socket/* {
		uri replace /console_socket /console/socket.io
		reverse_proxy * http://localhost:3001 {
			import header_options
	route /web_app_socket/* {
		uri replace /web_app_socket /web/socket.io
		reverse_proxy * http://localhost:3001 {
			import header_options
	route /api/* {
		reverse_proxy * http://localhost:3001 {
			import header_options

5. Links to relevant resources:

I might have solved this. It’s my etc/hosts file	localhost
::1		localhost	pop-os.localdomain	pop-os


::1		localhost

Seems to have solved it. But, if I needed this back for some reason, how would I set up Caddyfile to work for this?

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