# example of securing full service
# TODO replace domain and service name and port
service.example.com {
	forward_auth preauth {
		uri {uri}
		copy_headers Remote-User
	}
	reverse_proxy service-container:80
}

# you can choose to only restrict select paths
# or any other Caddy match criteria, if desired
# IE: https://protected.example.com/secure/
protected.example.com {
	# note any request that does not start with "/secure/" is NOT protected
	forward_auth /secure/* preauth {
		uri {uri}
		copy_headers Remote-User
	}
	reverse_proxy protected-service:9000
}

# optionally, if you want to use a subdomain for centeral preauth
# set SUBDOMAIN_REDIRECT to true
# and AUTH_SUBDOMAIN to match the subdomain you use here
auth.example.com {
	reverse_proxy preauth
}
