Skip to content

Commit

Permalink
Add exact match location blocks to avoid 301
Browse files Browse the repository at this point in the history
  • Loading branch information
ebaron committed Sep 25, 2024
1 parent f81fbf4 commit af7f01f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 5 deletions.
14 changes: 9 additions & 5 deletions internal/controllers/configmaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,11 @@ http {
{{- end }}
{{ range .AllowedPathPrefixes -}}
location {{ . }} {
location {{ . }}/ {
proxy_pass http://127.0.0.1:{{ $.CryostatPort }}$request_uri;
}
location = {{ . }} {
proxy_pass http://127.0.0.1:{{ $.CryostatPort }}$request_uri;
}
Expand Down Expand Up @@ -298,10 +302,10 @@ func (r *Reconciler) reconcileAgentProxyConfig(ctx context.Context, cr *model.Cr
HealthPort: constants.AgentProxyHealthPort,
CryostatPort: constants.CryostatHTTPContainerPort,
AllowedPathPrefixes: []string{
"/api/v2.2/discovery/",
"/api/v2.2/credentials/",
"/api/beta/recordings/",
"/health/",
"/api/v2.2/discovery",
"/api/v2.2/credentials",
"/api/beta/recordings",
"/health",
},
}
if tls != nil {
Expand Down
32 changes: 32 additions & 0 deletions internal/test/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -3356,18 +3356,34 @@ http {
proxy_pass http://127.0.0.1:8181$request_uri;
}
location = /api/v2.2/discovery {
proxy_pass http://127.0.0.1:8181$request_uri;
}
location /api/v2.2/credentials/ {
proxy_pass http://127.0.0.1:8181$request_uri;
}
location = /api/v2.2/credentials {
proxy_pass http://127.0.0.1:8181$request_uri;
}
location /api/beta/recordings/ {
proxy_pass http://127.0.0.1:8181$request_uri;
}
location = /api/beta/recordings {
proxy_pass http://127.0.0.1:8181$request_uri;
}
location /health/ {
proxy_pass http://127.0.0.1:8181$request_uri;
}
location = /health {
proxy_pass http://127.0.0.1:8181$request_uri;
}
location / {
return 404;
}
Expand Down Expand Up @@ -3424,18 +3440,34 @@ http {
proxy_pass http://127.0.0.1:8181$request_uri;
}
location = /api/v2.2/discovery {
proxy_pass http://127.0.0.1:8181$request_uri;
}
location /api/v2.2/credentials/ {
proxy_pass http://127.0.0.1:8181$request_uri;
}
location = /api/v2.2/credentials {
proxy_pass http://127.0.0.1:8181$request_uri;
}
location /api/beta/recordings/ {
proxy_pass http://127.0.0.1:8181$request_uri;
}
location = /api/beta/recordings {
proxy_pass http://127.0.0.1:8181$request_uri;
}
location /health/ {
proxy_pass http://127.0.0.1:8181$request_uri;
}
location = /health {
proxy_pass http://127.0.0.1:8181$request_uri;
}
location / {
return 404;
}
Expand Down

0 comments on commit af7f01f

Please sign in to comment.