Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@dhontecillas
Copy link
Contributor

@dhontecillas dhontecillas commented Aug 18, 2025

Fix #765

The filtering of the query strings values were made after the backend request URL was already constructed. By applying the filter before, it fixes the issue.

The issue was reproduced with: #764 (comment)

With the current solution, I've checked it works as expected:

krakend.json

{
    "$schema": "https://www.krakend.io/schema/v3.json",
    "version": 3,
    "name": "KrakenD Community API Gateway",
    "port": 8080,
    "host": ["http://localhost:8080"],
    "timeout": "3000ms",
    "debug_endpoint": true,
    "endpoints": [
        {
            "endpoint": "/test",
            "method": "GET",
            "backend": [
                {
                    "encoding": "json",
                    "method": "GET",
                    "host": ["http://localhost:8080"],
                    "input_headers": ["test"],
                    "input_query_strings": ["test"],
                    "url_pattern": "/__debug/?foo=bar"
                }
            ],
            "input_headers": ["test", "test2"],
            "input_query_strings": ["test", "test2"]
        }
    ],
    "sequential_start": false
}

Tests:

$ curl 'localhost:8080/test?k=p&test=a&test2=b&pp=j'
2025/08/18 19:06:02 KRAKEND DEBUG: [ENDPOINT: /__debug/*] Body:
 2025/08/18 - 19:06:02.374 [AccessLog] | 200 | 2.301ms |       127.0.0.1 | GET      /__debug/?foo=bar&test=a
 2025/08/18 - 19:06:02.376 [AccessLog] | 200 | 5.581ms |             ::1 | GET      /test?k=p&test=a&test2=b&pp=j

and without backend filtering:

$ curl 'localhost:8080/test?k=p'
2025/08/18 19:06:25 KRAKEND DEBUG: [ENDPOINT: /__debug/*] Body:
 2025/08/18 - 19:06:25.163 [AccessLog] | 200 | 0.297ms |       127.0.0.1 | GET      /__debug/?foo=bar
 2025/08/18 - 19:06:25.164 [AccessLog] | 200 | 1.312ms |             ::1 | GET      /test?k=p

…before the backend request is constructed

Signed-off-by: David Hontecillas <[email protected]>
@kpacha kpacha merged commit 868c3a2 into master Sep 3, 2025
5 checks passed
@kpacha kpacha deleted the sc-823/issue_765_filtered_query_string_on_proxy_level branch September 3, 2025 15:37
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.

Filtered query strings on proxy level appears in request

3 participants