fix(decoredirect): preserve path on apex redirect#23
Merged
Conversation
The permanent-redirect annotation was set to the bare target URL (e.g. https://www.client.com), causing nginx to redirect all requests to the root — discarding the path. Append nginx's \$request_uri variable so the full path and query string are preserved. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
permanent-redirect annotation does not support nginx variables — the admission webhook rejects values containing $. Switch to server-snippet with $request_uri so the full path and query string are preserved. Requires allow-snippet-annotations: true and annotations-risk-level: Critical in the nginx ingress controller config (infra_applications PRs #156, #157). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
nginx.ingress.kubernetes.io/permanent-redirectestava configurada com a URL base (https://www.client.com), fazendo o nginx redirecionar sempre para a raiz — qualquer path era descartado.$request_urià URL, preservando path e query string no redirect.oscarcalcados.com.br/promocao-botas→https://www.oscarcalcados.com.br/promocao-botas✓Impacto nos Ingresses existentes
Os
Ingressjá criados no cluster (comoredirect-htmx-store) serão corrigidos automaticamente pelo operator no próximo ciclo de reconciliação — oCreateOrUpdatevai sobrescrever a annotation antiga. Para forçar a reconciliação imediata basta fazer umtouchno CR:kubectl annotate decoredirect -n deco-redirect-system --all reconcile-at="$(date)" --overwriteTest plan
curl -si https://oscarcalcados.com.br/promocao-botasretornandoLocation: https://www.oscarcalcados.com.br/promocao-botas🤖 Generated with Claude Code
Summary by cubic
Preserves path and query string on apex redirects by switching to an NGINX
server-snippetthat returns<code> <to>$request_uri;. Replaces the unsupportedpermanent-redirectannotation that forced redirects to the root.Bug Fixes
nginx.ingress.kubernetes.io/permanent-redirectwithnginx.ingress.kubernetes.io/server-snippet: return <code> <to>$request_uri;; updated controller tests.Migration
allow-snippet-annotations: trueandannotations-risk-level: Criticalin the NGINX Ingress Controller.Ingressresources will be updated on the next reconcile. To force it now:kubectl annotate decoredirect -n deco-redirect-system --all reconcile-at="$(date)" --overwriteWritten for commit 998467a. Summary will update on new commits.