Commit a4b78e24 authored by ale's avatar ale

Pass /admin/metadata along to the Icecast leader

parent b82f0263
......@@ -12,6 +12,7 @@ import (
......@@ -53,6 +54,25 @@ func newHTTPHandler(n *Node, icecastPort int, domain string) http.Handler {
mux.Handle("/debug/", h)
// A very narrow selection of Icecast API methods is served
// below /admin/ and forwarded to the Icecast master via a
// standard httputil.ReverseProxy.
adminHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
leaderAddr := n.leaderAddr()
if leaderAddr == "" {
http.Error(w, "No leader", http.StatusServiceUnavailable)
rp := httputil.NewSingleHostReverseProxy(&url.URL{
Scheme: "http",
Host: leaderAddr,
rp.ServeHTTP(w, r)
mux.Handle("/admin/metadata", adminHandler)
mux.Handle("/admin/killsource", adminHandler)
// Requests for /_stream/ go straight to the local Icecast.
proxyHandler := http.StripPrefix(autoradio.IcecastMountPrefix,
withMount(n, func(m *pb.Mount, w http.ResponseWriter, r *http.Request) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment