{
	auto_https off
}

http://{$AUTH_DOMAIN} {
	@auth_admin path /if/admin /if/admin/*
	redir @auth_admin http://{$AUTH_ADMIN_DOMAIN:auth-admin.nas.nodedc}:{$NODEDC_PUBLIC_HTTP_PORT}{uri} 302

	@auth_root path /
	redir @auth_root http://{$LAUNCHER_DOMAIN}:{$NODEDC_PUBLIC_HTTP_PORT}/ 302

	@auth_user_dashboard path /if/user /if/user/*
	redir @auth_user_dashboard http://{$LAUNCHER_DOMAIN}:{$NODEDC_PUBLIC_HTTP_PORT}/ 302

	reverse_proxy authentik-server:9000 {
		header_up Host {http.request.host}
		header_up X-Forwarded-Proto {scheme}
		header_up X-Forwarded-For {remote_host}
	}
}

http://{$AUTH_ADMIN_DOMAIN:auth-admin.nas.nodedc}, http://{$AUTH_ADMIN_LAN_HOST:172.22.0.222} {
	@admin_root path /
	redir @admin_root /if/admin/ 302

	reverse_proxy authentik-server:9000 {
		header_up Host {http.request.host}
		header_up X-Forwarded-Proto {scheme}
		header_up X-Forwarded-For {remote_host}
	}
}

http://{$LAUNCHER_DOMAIN} {
	reverse_proxy launcher:5173 {
		header_up Host {http.request.host}
		header_up X-Forwarded-Proto {scheme}
		header_up X-Forwarded-For {remote_host}
	}
}

http://{$TASK_DOMAIN} {
	reverse_proxy {$SYNOLOGY_TASK_MANAGER_UPSTREAM} {
		header_up Host {http.request.host}
		header_up X-Forwarded-Host {http.request.host}
		header_up X-Forwarded-Proto {scheme}
		header_up X-Forwarded-Port {$NODEDC_PUBLIC_HTTP_PORT}
		header_up X-Forwarded-For {remote_host}
	}
}

http://{$BIM_DOMAIN:bim.nodedc.tech} {
	reverse_proxy {$SYNOLOGY_BIM_VIEWER_UPSTREAM:host.docker.internal:18100} {
		header_up Host {http.request.host}
		header_up X-Forwarded-Host {http.request.host}
		header_up X-Forwarded-Proto https
		header_up X-Forwarded-Port 443
		header_up X-Forwarded-For {remote_host}
	}
}

http://id.nodedc.ru {
	@auth_admin path /if/admin /if/admin/*
	respond @auth_admin 404

	@auth_root path /
	redir @auth_root https://hub.nodedc.ru/ 302

	@auth_user_dashboard path /if/user /if/user/*
	redir @auth_user_dashboard https://hub.nodedc.ru/ 302

	reverse_proxy authentik-server:9000 {
		header_up Host id.nodedc.ru
		header_up X-Forwarded-Host id.nodedc.ru
		header_up X-Forwarded-Proto https
		header_up X-Forwarded-Port 443
		header_up X-Forwarded-For {remote_host}
	}
}

http://hub.nodedc.ru {
	reverse_proxy launcher:5173 {
		header_up Host hub.nodedc.ru
		header_up X-Forwarded-Host hub.nodedc.ru
		header_up X-Forwarded-Proto https
		header_up X-Forwarded-Port 443
		header_up X-Forwarded-For {remote_host}
	}
}

http://ops.nodedc.ru {
	reverse_proxy {$SYNOLOGY_TASK_MANAGER_UPSTREAM} {
		header_up Host ops.nodedc.ru
		header_up X-Forwarded-Host ops.nodedc.ru
		header_up X-Forwarded-Proto https
		header_up X-Forwarded-Port 443
		header_up X-Forwarded-For {remote_host}
	}
}
