element/server/handler.go
Evan Hazlett a89aa40dda
proxy: start on api and caddy based proxy
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-07-29 22:54:43 -04:00

26 lines
595 B
Go

package server
import (
"net/http"
"time"
"github.com/sirupsen/logrus"
)
func (s *Server) genericHandler(w http.ResponseWriter, r *http.Request) {
logrus.WithFields(logrus.Fields{
"host": r.Host,
"uri": r.RequestURI,
}).Debug("new domain request")
// TODO: check and / or configure backend container
time.Sleep(time.Millisecond * 1000)
// TODO: update proxy config with new backend
time.Sleep(time.Millisecond * 1000)
// TODO: issue redirect to host to have client re-send and connect to backend
w.Header().Set("Location", r.RequestURI)
w.WriteHeader(http.StatusFound)
}