#  _ __   ___ ____     _ __  _ __ _____  ___   _
# | '_ \ / _ \_  /____| '_ \| '__/ _ \ \/ / | | |
# | |_) |  __// /_____| |_) | | | (_) >  <| |_| |
# | .__/ \___/___|    | .__/|_|  \___/_/\_\\__, |
# |_|                 |_|                  |___/
#

{
        admin 100.67.6.27:2019
        metrics {
                per_host
        }
}

## LONDON-A SERVICES ##

# Grafana
grafana.pez.solutions, grafana.pez.sh {
        forward_auth localhost:9091 {
		uri /api/authz/forward-auth
		copy_headers Remote-User Remote-Groups Remote-Name Remote-Email
	}
        reverse_proxy 100.122.219.41:3000
}

# Prometheus
prometheus.pez.solutions, prometheus.pez.sh {
	forward_auth localhost:9091 {
		uri /api/authz/forward-auth
		copy_headers Remote-User Remote-Groups Remote-Name Remote-Email
	}
        reverse_proxy 100.122.219.41:9090
}

# Alertmanager
alertmanager.pez.solutions, alertmanager.pez.sh {
	forward_auth localhost:9091 {
		uri /api/authz/forward-auth
		copy_headers Remote-User Remote-Groups Remote-Name Remote-Email
	}
        reverse_proxy 100.122.219.41:3000
}

## LONDON-B SERVICES ##

# Jellyfin
jellyfin.pez.solutions, jellyfin.pez.sh {
        reverse_proxy 100.84.65.101:8096
}

# Plex
plex.pez.solutions, plex.pez.sh {
        reverse_proxy 100.84.65.101:32400
}

# Radarr
radarr.pez.solutions, radarr.pez.sh {
	forward_auth localhost:9091 {
		uri /api/authz/forward-auth
		copy_headers Remote-User Remote-Groups Remote-Name Remote-Email
	}
        reverse_proxy 100.84.65.101:7878
}

# Sonarr
sonarr.pez.solutions, sonarr.pez.sh {
	forward_auth localhost:9091 {
		uri /api/authz/forward-auth
		copy_headers Remote-User Remote-Groups Remote-Name Remote-Email
	}
        reverse_proxy 100.84.65.101:8989
}

# Lidarr
lidarr.pez.solutions, lidarr.pez.sh {
	forward_auth localhost:9091 {
		uri /api/authz/forward-auth
		copy_headers Remote-User Remote-Groups Remote-Name Remote-Email
	}
        reverse_proxy 100.84.65.101:8686
}

# Readarr
readarr.pez.solutions, readarr.pez.sh {
	forward_auth localhost:9091 {
		uri /api/authz/forward-auth
		copy_headers Remote-User Remote-Groups Remote-Name Remote-Email
	}
        reverse_proxy 100.84.65.101:8787
}

# slskd
soulseek.pez.solutions, soulseek.pez.sh {
	forward_auth localhost:9091 {
		uri /api/authz/forward-auth
		copy_headers Remote-User Remote-Groups Remote-Name Remote-Email
	}
        reverse_proxy 100.84.65.101:5030
}

# Prowlarr
prowlarr.pez.solutions, prowlarr.pez.sh {
	forward_auth localhost:9091 {
		uri /api/authz/forward-auth
		copy_headers Remote-User Remote-Groups Remote-Name Remote-Email
	}
        reverse_proxy 100.84.65.101:9696
}

# Transmission
download.pez.solutions, download.pez.sh {
	forward_auth localhost:9091 {
		uri /api/authz/forward-auth
		copy_headers Remote-User Remote-Groups Remote-Name Remote-Email
	}
        reverse_proxy 100.84.65.101:9091
}

# Overseerr
request.pez.solutions, request.pez.sh {
        reverse_proxy 100.84.65.101:5055
}

# Jellyfin Requests
jellyfin-requests.pez.solutions, jellyfin-requests.pez.sh {
        reverse_proxy 100.84.65.101:5056
}

#WebDAV
#https://cloud.pez.sh {
#        reverse_proxy 100.84.65.101:8080
#}

https://cloud.pez.sh:443 {
	reverse_proxy 100.84.65.101:11000 # Adjust to match APACHE_PORT and APACHE_IP_BINDING. See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md#adapting-the-sample-web-server-configurations-below
}

music.pez.sh {
	reverse_proxy 100.84.65.101:4533
}

## LONDON-C SERVICES ##

## COPENHAGEN-A SERVICES ##

## COPENHAGEN-B SERVICES ##

## COPENHAGEN-C SERVICES ##

## NUREMBERG-A SERVICES ##

## HELSINKI-A SERVICES ##

# Bitwarden (requires HTTPS tweaking)
https://bitwarden.pez.sh {
        reverse_proxy localhost:8443 {
                transport http {
                        tls_insecure_skip_verify
                }
        }
}

# Authelia (requires HTTPS tweaking)
auth.pez.solutions, auth.pez.sh {
	reverse_proxy localhost:9091
}

ldap.pez.sh {
	reverse_proxy 127.0.0.1:17170
}
#https://auth.pez.sh {
#        reverse_proxy 127.0.0.1:9091 {
#                transport http {
#                        tls_insecure_skip_verify
#                }
#        }
#}

# Apps dashboard
apps.pez.solutions, apps.pez.sh {
        root * /srv/apps
        forward_auth localhost:9091 {
		uri /api/authz/forward-auth
		copy_headers Remote-User Remote-Groups Remote-Name Remote-Email
	}
	file_server
}

# Pez.solutions
pez.solutions {
        root * /srv/pez.solutions
        file_server
}

# Pez.solutions
cloud.pez.solutions {
        root * /srv/cloud.pez.solutions
        file_server
}

# Pez.sh
pez.sh {
        root * /srv/pez.sh
        file_server
}

# Pez-signup
signup.pez.solutions {
        root * /srv/pez-signup
        file_server
}

# Naveen
naveen.pez.sh {
	root * /srv/naveen
	file_server
}

## HELSINKI-A SERVICES ##

# Status page
status.pez.sh {
    root * /srv/status
    file_server
}

# Miniflux RSS
rss.pez.sh {
        forward_auth localhost:9091 {
                uri /api/authz/forward-auth
                copy_headers Remote-User Remote-Groups Remote-Name Remote-Email
        }
        reverse_proxy 100.84.65.101:8181
}


# Forgejo Git Server (auth handled by Forgejo itself)
git.pez.sh {
        reverse_proxy localhost:3000
}


# This Website Does Not Exist
thiswebsitedoesnotexist.pez.sh {
        reverse_proxy localhost:3721
}
