(auth) {
	# Forward /auth/ to the authentication service
	@auth path /auth/*
	handle @auth {
		reverse_proxy localhost:4401
	}
	handle {
		# Check for authentication
		forward_auth localhost:4401 {
			uri /auth/forward-auth
			copy_headers x-auth*
		}
		{block}
	}
}

localhost {
	import auth {
		# Proxy authenticated requests to the main application
		reverse_proxy localhost:3000
	}
}
