Skip to content

Commit

Permalink
Add CustomHTTPErrors directive (#11699)
Browse files Browse the repository at this point in the history
* Add CustomHTTPErrors directive

* Fix: Add missing '=' in error_page directive
  • Loading branch information
MrErlison authored and rikatz committed Sep 15, 2024
1 parent 0d9ef1a commit 7d0dd66
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/ingress/controller/template/crossplane/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ func (c *Template) buildHTTP() {
httpBlock = append(httpBlock, buildMapDirective("$http_referer", "$block_ref", refDirectives))
}

for _, v := range cfg.CustomHTTPErrors {
httpBlock = append(httpBlock, buildDirective("error_page", v, "=",
fmt.Sprintf("@custom_upstream-default-backend_%d", v)))
}

c.config.Parsed = append(c.config.Parsed, &ngx_crossplane.Directive{
Directive: "http",
Block: httpBlock,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ http {
default "$";
}

# MIGRATED
{{ range $errCode := $cfg.CustomHTTPErrors }}
error_page {{ $errCode }} = @custom_upstream-default-backend_{{ $errCode }};{{ end }}

Expand Down

0 comments on commit 7d0dd66

Please sign in to comment.