{
	auto_https disable_redirects
	admin off
}

https://127.0.0.1:{$PARALLAIZE_CADDY_PORT:8080}, https://localhost:{$PARALLAIZE_CADDY_PORT:8080}, https://{$HOSTNAME:localhost}:{$PARALLAIZE_CADDY_PORT:8080}, https://{$PARALLAIZE_FORWARDED_SERVICE_HOST_BASE:parallaize.localhost}:{$PARALLAIZE_CADDY_PORT:8080}, https://*.{$PARALLAIZE_FORWARDED_SERVICE_HOST_BASE:parallaize.localhost}:{$PARALLAIZE_CADDY_PORT:8080} {
	encode gzip zstd
	tls internal

	@vnc path_regexp vnc ^/api/vms/[^/]+/vnc$
	handle @vnc {
		reverse_proxy 127.0.0.1:{$PORT:3000} {
			flush_interval -1
			transport http {
				versions 1.1
			}
		}
	}

	@events path /events
	handle @events {
		reverse_proxy 127.0.0.1:{$PORT:3000}
	}

	@api path /api/*
	handle @api {
		reverse_proxy 127.0.0.1:{$PORT:3000}
	}

	@vm_forwards path /vm/*
	handle @vm_forwards {
		reverse_proxy 127.0.0.1:{$PORT:3000} {
			transport http {
				versions 1.1
			}
		}
	}

	handle {
		reverse_proxy 127.0.0.1:{$PORT:3000}
	}
}
