Skip to content
Snippets Groups Projects
Verified Commit 29e0a6a9 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Improve docker images

parent ce3ff1a2
No related branches found
No related tags found
No related merge requests found
FROM golang:alpine as go_builder FROM golang:alpine as go_builder
RUN apk add --no-cache curl git gcc musl-dev RUN apk add --no-cache musl-dev
RUN curl https://glide.sh/get | sh
WORKDIR /go/src/app WORKDIR /go/src/app
COPY *.go go.* ./ COPY *.go go.* ./
RUN go mod download RUN go mod download
RUN CGO_ENABLED=false go build -o app . RUN CGO_ENABLED=false go build -o app .
FROM alpine:3.10 FROM gcr.io/distroless/static
RUN apk add --no-cache ca-certificates
WORKDIR / WORKDIR /
COPY --from=go_builder /go/src/app/app /app COPY --from=go_builder /go/src/app/app /app
COPY templates /templates COPY templates /templates
......
...@@ -97,6 +97,21 @@ func (r *oauthProxy) loggingMiddleware(next http.Handler) http.Handler { ...@@ -97,6 +97,21 @@ func (r *oauthProxy) loggingMiddleware(next http.Handler) http.Handler {
}) })
} }
// requestHeaderSanitizingMiddleware is responsible for sanitizing the request headers
func (r *oauthProxy) requestHeaderSanitizingMiddleware() func(http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
for k := range req.Header {
if strings.HasPrefix(strings.ToLower(k), "x-auth") {
req.Header.Del(k)
}
}
next.ServeHTTP(w, req)
})
}
}
// authenticationMiddleware is responsible for verifying the access token // authenticationMiddleware is responsible for verifying the access token
func (r *oauthProxy) authenticationMiddleware(whitelisted bool) func(http.Handler) http.Handler { func (r *oauthProxy) authenticationMiddleware(whitelisted bool) func(http.Handler) http.Handler {
return func(next http.Handler) http.Handler { return func(next http.Handler) http.Handler {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment