Skip to content
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

Fix regression #1543

Merged
merged 1 commit into from
Mar 26, 2025
Merged

Fix regression #1543

merged 1 commit into from
Mar 26, 2025

Conversation

tkan145
Copy link
Contributor

@tkan145 tkan145 commented Mar 19, 2025

What

Discovered this regression while investigate THREESCALE-11741

In PR #1503 we return nil and error in case of an error, however some code paths do not handle the error but instead check the error field of the response object and lead to unexpected behavior (bypass backend-listener authrep call).

The return value of http_ng backends is also inconsistent, some backends return errors while others return response objects with error fields. This leads to some code paths checking for errors (always nil for resty backends) while others check the response object for errors or ignore errors altogether. This needs to be investigated

Verification steps

  • Checkout this branch
  • Build a new runtime image
make runtime-image IMAGE_NAME=apicast-test
  • Get into dev-env
dev-environments/plain-http-upstream
  • Edit docker-compose.yml as follow
diff --git a/dev-environments/plain-http-upstream/docker-compose.yml b/dev-environments/plain-http-upstream/docker-compose.yml
index ebf84ebc..182a6294 100644
--- a/dev-environments/plain-http-upstream/docker-compose.yml
+++ b/dev-environments/plain-http-upstream/docker-compose.yml
@@ -15,6 +15,7 @@ services:
       APICAST_WORKERS: 1
       APICAST_LOG_LEVEL: debug
       APICAST_CONFIGURATION_CACHE: "0"
+      BACKEND_ENDPOINT_OVERRIDE: "http://invalid-backend"
     expose:
       - "8080"
       - "8090"
  • Start gateway
make gateway IMAGE_NAME=apicast-test
  • Send request
curl --resolve get.example.com:8080:127.0.0.1 -v "http://get.example.com:8080/?user_key=123"

You should get HTTP/1.1 403 Forbidden

In PR 3scale#1503 we return nil and error in case of an error, however some
code paths do not handle the error but instead check the error field of
the response object and lead to unexpected behavior.

With this PR, we will return a response object with the error field set.
@tkan145 tkan145 requested a review from a team as a code owner March 19, 2025 04:26
@tkan145 tkan145 merged commit 2f6e61d into 3scale:master Mar 26, 2025
14 checks passed
@tkan145 tkan145 deleted the fix-regression branch March 26, 2025 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants