outposts/proxy: fix static files not being served in proxy mode
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
d5d8641b37
commit
202b057ce9
|
@ -2,6 +2,7 @@ package proxyv2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
@ -17,7 +18,7 @@ func (ps *ProxyServer) HandlePing(rw http.ResponseWriter, r *http.Request) {
|
||||||
metrics.Requests.With(prometheus.Labels{
|
metrics.Requests.With(prometheus.Labels{
|
||||||
"outpost_name": ps.akAPI.Outpost.Name,
|
"outpost_name": ps.akAPI.Outpost.Name,
|
||||||
"method": r.Method,
|
"method": r.Method,
|
||||||
"schema": r.URL.Scheme,
|
"scheme": r.URL.Scheme,
|
||||||
"path": r.URL.Path,
|
"path": r.URL.Path,
|
||||||
"host": web.GetHost(r),
|
"host": web.GetHost(r),
|
||||||
"type": "ping",
|
"type": "ping",
|
||||||
|
@ -33,7 +34,7 @@ func (ps *ProxyServer) HandleStatic(rw http.ResponseWriter, r *http.Request) {
|
||||||
metrics.Requests.With(prometheus.Labels{
|
metrics.Requests.With(prometheus.Labels{
|
||||||
"outpost_name": ps.akAPI.Outpost.Name,
|
"outpost_name": ps.akAPI.Outpost.Name,
|
||||||
"method": r.Method,
|
"method": r.Method,
|
||||||
"schema": r.URL.Scheme,
|
"scheme": r.URL.Scheme,
|
||||||
"path": r.URL.Path,
|
"path": r.URL.Path,
|
||||||
"host": web.GetHost(r),
|
"host": web.GetHost(r),
|
||||||
"type": "ping",
|
"type": "ping",
|
||||||
|
@ -42,6 +43,10 @@ func (ps *ProxyServer) HandleStatic(rw http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ps *ProxyServer) Handle(rw http.ResponseWriter, r *http.Request) {
|
func (ps *ProxyServer) Handle(rw http.ResponseWriter, r *http.Request) {
|
||||||
|
if strings.HasPrefix(r.URL.Path, "/akprox/static") {
|
||||||
|
ps.HandleStatic(rw, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
host := web.GetHost(r)
|
host := web.GetHost(r)
|
||||||
a, ok := ps.apps[host]
|
a, ok := ps.apps[host]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
Reference in New Issue