Repository navigation
fix(#8179) Add support for nginx and haproxy returning json error pages #8446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
053ce37
Add support for nginx returning json error pages
7df500b
PR feedback: update readme, remove unused logic
0451f3c
Remove 404 failure check for nginx
nydr f59b5e9
Update tests to work with http2 update
e0d31ca
Merge remote-tracking branch 'origin/master' into dn/8179-nginx-json
6c1b854
chore(#8179) Add json error messages to haproxy (#8481)
nydr 6ec3b04
Move nginx test related files to tests dir
1f53d0c
Update haproxy/errorsREADME.md
nydr 054992c
Include templates in file comparison. Cleanup compose
d581707
Skip checking exit code for 404 bats test
2925f11
PR feedback: Update for sonarcloud code convention
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| name: Nginx test | ||
|
|
||
| on: [push, pull_request] | ||
|
|
||
| jobs: | ||
|
|
||
| test: | ||
| name: Run compose tests | ||
| runs-on: ubuntu-22.04 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - name: Run test | ||
| run: | | ||
| sudo apt update | ||
| sudo apt install -y bats | ||
| { | ||
| cd nginx | ||
| make test | ||
| } | ||
|
mrjones-plip marked this conversation as resolved.
Resolved
|
||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| COMPOSE_FILE=docker-compose.test.yml | ||
|
|
||
| docker_build: | ||
| docker build --target test_nginx . | ||
|
|
||
| start: docker_build | ||
| env BUILD_TARGET=cht-nginx docker compose -f ${COMPOSE_FILE} up --wait --wait-timeout 15 --build | ||
|
|
||
| test: start | ||
| bats tests/compose.bats | ||
| $(MAKE) stop | ||
|
|
||
| stop: | ||
| docker compose -f ${COMPOSE_FILE} stop | ||
|
nydr marked this conversation as resolved.
Resolved
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| error_page 301 =301 /nginx_error_pages/301.$error_extension; | ||
| error_page 302 =302 /nginx_error_pages/302.$error_extension; | ||
| error_page 303 =303 /nginx_error_pages/303.$error_extension; | ||
| error_page 307 =307 /nginx_error_pages/307.$error_extension; | ||
| error_page 308 =308 /nginx_error_pages/308.$error_extension; | ||
| error_page 400 =400 /nginx_error_pages/400.$error_extension; | ||
| error_page 401 =401 /nginx_error_pages/401.$error_extension; | ||
| error_page 402 =402 /nginx_error_pages/402.$error_extension; | ||
| error_page 403 =403 /nginx_error_pages/403.$error_extension; | ||
| error_page 404 =404 /nginx_error_pages/404.$error_extension; | ||
| error_page 405 =405 /nginx_error_pages/405.$error_extension; | ||
| error_page 406 =406 /nginx_error_pages/406.$error_extension; | ||
| error_page 408 =408 /nginx_error_pages/408.$error_extension; | ||
| error_page 409 =409 /nginx_error_pages/409.$error_extension; | ||
| error_page 410 =410 /nginx_error_pages/410.$error_extension; | ||
| error_page 411 =411 /nginx_error_pages/411.$error_extension; | ||
| error_page 412 =412 /nginx_error_pages/412.$error_extension; | ||
| error_page 413 =413 /nginx_error_pages/413.$error_extension; | ||
| error_page 414 =414 /nginx_error_pages/414.$error_extension; | ||
| error_page 415 =415 /nginx_error_pages/415.$error_extension; | ||
| error_page 416 =416 /nginx_error_pages/416.$error_extension; | ||
| error_page 421 =421 /nginx_error_pages/421.$error_extension; | ||
| error_page 429 =429 /nginx_error_pages/429.$error_extension; | ||
| error_page 494 =494 /nginx_error_pages/494.$error_extension; | ||
| error_page 495 =495 /nginx_error_pages/495.$error_extension; | ||
| error_page 496 =496 /nginx_error_pages/496.$error_extension; | ||
| error_page 497 =497 /nginx_error_pages/497.$error_extension; | ||
| error_page 500 =500 /nginx_error_pages/500.$error_extension; | ||
| error_page 501 =501 /nginx_error_pages/501.$error_extension; | ||
| error_page 502 =502 /nginx_error_pages/502.$error_extension; | ||
| error_page 503 =503 /nginx_error_pages/503.$error_extension; | ||
| error_page 504 =504 /nginx_error_pages/504.$error_extension; | ||
| error_page 505 =505 /nginx_error_pages/505.$error_extension; | ||
| error_page 507 =507 /nginx_error_pages/507.$error_extension; | ||
|
|
||
| location /nginx_error_pages { | ||
| internal; | ||
| root /usr/share/nginx; | ||
| } | ||
|
|
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,26 @@ | ||
| [ | ||
| { | ||
| "httpRequest": { | ||
| "path": "/" | ||
| }, | ||
| "httpResponse": { | ||
| "body": "Hello from CHT api mock" | ||
| } | ||
| { | ||
| "httpRequest": { | ||
| "path": "/" | ||
| }, | ||
| { | ||
| "httpRequest": { | ||
| "path": "/somepath" | ||
| }, | ||
| "httpResponse": { | ||
| "body": "Test" | ||
| } | ||
| "httpResponse": { | ||
| "body": "Hello from CHT api mock" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "httpRequest": { | ||
| "path": "/somepath" | ||
| }, | ||
| "httpResponse": { | ||
| "body": "Test" | ||
| } | ||
| }, | ||
| { | ||
| "httpRequest": { | ||
| "path": "/error/drop" | ||
| }, | ||
| "httpError": { | ||
| "dropConnection": true | ||
| } | ||
| } | ||
| ] |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <html> | ||
|
|
||
| <head> | ||
| <title>301 Moved Permanently</title> | ||
| </head> | ||
|
|
||
| <body> | ||
| <center> | ||
| <h1>301 Moved Permanently</h1> | ||
| </center> | ||
| <hr> | ||
| <center>nginx</center> | ||
| </body> | ||
|
|
||
| </html> |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "type": "ERROR", | ||
| "error": "301 Moved Permanently", | ||
| "server": "nginx" | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <html> | ||
|
|
||
| <head> | ||
| <title>302 Found</title> | ||
| </head> | ||
|
|
||
| <body> | ||
| <center> | ||
| <h1>302 Found</h1> | ||
| </center> | ||
| <hr> | ||
| <center>nginx</center> | ||
| </body> | ||
|
|
||
| </html> |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "type": "ERROR", | ||
| "error": "302 Found", | ||
| "server": "nginx" | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <html> | ||
|
|
||
| <head> | ||
| <title>303 See Other</title> | ||
| </head> | ||
|
|
||
| <body> | ||
| <center> | ||
| <h1>303 See Other</h1> | ||
| </center> | ||
| <hr> | ||
| <center>nginx</center> | ||
| </body> | ||
|
|
||
| </html> |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "type": "ERROR", | ||
| "error": "303 See Other", | ||
| "server": "nginx" | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <html> | ||
|
|
||
| <head> | ||
| <title>307 Temporary Redirect</title> | ||
| </head> | ||
|
|
||
| <body> | ||
| <center> | ||
| <h1>307 Temporary Redirect</h1> | ||
| </center> | ||
| <hr> | ||
| <center>nginx</center> | ||
| </body> | ||
|
|
||
| </html> |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "type": "ERROR", | ||
| "error": "307 Temporary Redirect", | ||
| "server": "nginx" | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <html> | ||
|
|
||
| <head> | ||
| <title>308 Permanent Redirect</title> | ||
| </head> | ||
|
|
||
| <body> | ||
| <center> | ||
| <h1>308 Permanent Redirect</h1> | ||
| </center> | ||
| <hr> | ||
| <center>nginx</center> | ||
| </body> | ||
|
|
||
| </html> |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "type": "ERROR", | ||
| "error": "308 Permanent Redirect", | ||
| "server": "nginx" | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <html> | ||
|
|
||
| <head> | ||
| <title>400 Bad Request</title> | ||
| </head> | ||
|
|
||
| <body> | ||
| <center> | ||
| <h1>400 Bad Request</h1> | ||
| </center> | ||
| <hr> | ||
| <center>nginx</center> | ||
| </body> | ||
|
|
||
| </html> |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "type": "ERROR", | ||
| "error": "400 Bad Request", | ||
| "server": "nginx" | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <html> | ||
|
|
||
| <head> | ||
| <title>401 Authorization Required</title> | ||
| </head> | ||
|
|
||
| <body> | ||
| <center> | ||
| <h1>401 Authorization Required</h1> | ||
| </center> | ||
| <hr> | ||
| <center>nginx</center> | ||
| </body> | ||
|
|
||
| </html> |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "type": "ERROR", | ||
| "error": "401 Authorization Required", | ||
| "server": "nginx" | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.