Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .bazelci/basic-auth-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ bazel build //:bazel-remote --remote_cache=grpc://localhost:9092 \
kill -9 $server_pid
sleep 2
./bazel-remote --dir "$tmpdir/cache" --max_size 1 --http_address "0.0.0.0:$HTTP_PORT" \
--enable_endpoint_metrics \
--htpasswd_file "$tmpdir/htpasswd" > "$tmpdir/bazel-remote-authenticated.log" 2>&1 &
server_pid=$!

Expand Down Expand Up @@ -186,6 +187,15 @@ then
exit 1
fi

# Unauthenticated status read should fail.
if wget --inet4-only -d -O - --timeout=2 \
"http://localhost:$HTTP_PORT/status"
then
echo "Error: expected unauthenticated read to fail"
kill -9 $server_pid
exit 1
fi

# Run without auth, expect no access.
if ! bazel run //utils/grpcreadclient -- -server-addr localhost:9092
then
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ func startHttpServer(c *config.Config, httpServer **http.Server,
}
mux.Handle("/metrics", middlewareHandler)

statusHandler = middlewarestd.Handler("status", metricsMdlw, http.HandlerFunc(h.StatusPageHandler)).ServeHTTP
statusHandler = middlewarestd.Handler("status", metricsMdlw, statusHandler).ServeHTTP

ch := cacheHandler // Avoid an infinite loop in the closure below.
cacheHandler = func(w http.ResponseWriter, r *http.Request) {
Expand Down