Open
Description
Describe the bug
When running the integration tests for the Lura project, the tests fail due to an unexpected value in the X-Forwarded-For header. The tests expect this header to be an empty string ([""]
), but it is set to ["127.0.0.1"]
, causing the tests to fail.
To Reproduce
Steps to reproduce the behavior:
- Configuration used
- Environment: macOS
- macOS version: Sonoma 14.0
- Go version: 1.23
- Branch: main
- Configuration under
/etc/hosts
:127.0.0.1 localhost
- No modifications were made on the project; it was cloned directly from the repository.
- Steps to run the software
- Clone the Lura project:
git clone https://github.com/luraproject/lura.git
- Navigate to the project directory:
cd lura
- Execute the same steps as found in automated tests
go build -v ./...
: Success!go test -cover -race ./...
: Success!go test -tags integration ./test
: Here is where it fails!
- Clone the Lura project:
Note that in all the tests that failed, the expected behavior was for the X-Forwarded-For
header to be empty ([""]
), but it was populated with ["127.0.0.1"]
.
Expected behavior
The integration tests should pass successfully
Logs
--- FAIL: TestKrakenD_ginRouter (1.02s)
--- FAIL: TestKrakenD_ginRouter/multipost_parallel (0.00s)
integration_test.go:448: /multipost/parallel/foo: unexpected body: {"first":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Host":["localhost:9079"]},"method":"POST","url":"/provider/foo"},"second":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Host":["localhost:9079"]},"method":"POST","url":"/recipient/foo"}}
/multipost/parallel/foo was expecting: {"first":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":[""],"X-Forwarded-Host":["localhost:9079"]},"method":"POST","url":"/provider/foo"},"second":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":[""],"X-Forwarded-Host":["localhost:9079"]},"method":"POST","url":"/recipient/foo"}}
--- FAIL: TestKrakenD_ginRouter/multipost_sequential (0.00s)
integration_test.go:448: /multipost/sequential/foo: unexpected body: {"first":{"path":"/provider/foo","random":42},"second":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Host":["localhost:9079"]},"method":"POST","url":"/recipient/42"},"third":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Host":["localhost:9079"]},"method":"POST","url":"/recipient/42"}}
/multipost/sequential/foo was expecting: {"first":{"path":"/provider/foo","random":42},"second":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":[""],"X-Forwarded-Host":["localhost:9079"]},"method":"POST","url":"/recipient/42"},"third":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":[""],"X-Forwarded-Host":["localhost:9079"]},"method":"POST","url":"/recipient/42"}}
--- FAIL: TestKrakenD_gorillaRouter (0.42s)
--- FAIL: TestKrakenD_gorillaRouter/multipost_parallel (0.00s)
integration_test.go:448: /multipost/parallel/foo: unexpected body: {"first":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Host":["localhost:9997"]},"method":"POST","url":"/provider/foo"},"second":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Host":["localhost:9997"]},"method":"POST","url":"/recipient/foo"}}
/multipost/parallel/foo was expecting: {"first":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":[""],"X-Forwarded-Host":["localhost:9997"]},"method":"POST","url":"/provider/foo"},"second":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":[""],"X-Forwarded-Host":["localhost:9997"]},"method":"POST","url":"/recipient/foo"}}
--- FAIL: TestKrakenD_gorillaRouter/multipost_sequential (0.00s)
integration_test.go:448: /multipost/sequential/foo: unexpected body: {"first":{"path":"/provider/foo","random":42},"second":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Host":["localhost:9997"]},"method":"POST","url":"/recipient/42"},"third":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Host":["localhost:9997"]},"method":"POST","url":"/recipient/42"}}
/multipost/sequential/foo was expecting: {"first":{"path":"/provider/foo","random":42},"second":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":[""],"X-Forwarded-Host":["localhost:9997"]},"method":"POST","url":"/recipient/42"},"third":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":[""],"X-Forwarded-Host":["localhost:9997"]},"method":"POST","url":"/recipient/42"}}
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 645.666µs | localhost:8540 | GET /static
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 544.583µs | localhost:8540 | POST /param_forwarding/foo/constant/bar
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 250.459µs | localhost:8540 | POST /param_forwarding/foo/constant/foobar
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 86.282708ms | localhost:8540 | GET /timeout
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 1.069625ms | localhost:8540 | GET /partial/static
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 608.042µs | localhost:8540 | GET /partial
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 574.417µs | localhost:8540 | GET /combination
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 497.125µs | localhost:8540 | GET /detail_error
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 428.833µs | localhost:8540 | GET /querystring-params-test/no-params
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 211.333µs | localhost:8540 | GET /querystring-params-test/query-params
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 363.625µs | localhost:8540 | GET /querystring-params-test/url-params/some
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 179.875µs | localhost:8540 | GET /querystring-params-test/all-params
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 154.667µs | localhost:8540 | GET /header-params-test/no-params
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 1.670917ms | localhost:8540 | GET /header-params-test/filter-params
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 142.458µs | localhost:8540 | GET /header-params-test/all-params
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 596.125µs | localhost:8540 | GET /sequential/ok/foo
[negroni] 2025-03-19T18:32:43-03:00 | 500 | 127.791µs | localhost:8540 | GET /sequential/ko/first/foo
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 372.375µs | localhost:8540 | GET /sequential/ko/last/foo
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 349.125µs | localhost:8540 | GET /redirect
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 345.25µs | localhost:8540 | GET /found
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 101.625µs | localhost:8540 | GET /flatmap/delete
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 126.292µs | localhost:8540 | GET /flatmap/rename
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 288.625µs | localhost:8540 | GET /x-forwarded-for
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 202.5µs | localhost:8540 | PUT /sequence-accept
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 87.5µs | localhost:8540 | GET /error-status-code/1
[negroni] 2025-03-19T18:32:43-03:00 | 429 | 275.291µs | localhost:8540 | GET /error-status-code/2
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 162.625µs | localhost:8540 | GET /error-status-code/3
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 490.375µs | localhost:8540 | POST /multipost/parallel/foo
[negroni] 2025-03-19T18:32:43-03:00 | 200 | 445.834µs | localhost:8540 | POST /multipost/sequential/foo
--- FAIL: TestKrakenD_negroniRouter (0.42s)
--- FAIL: TestKrakenD_negroniRouter/multipost_parallel (0.00s)
integration_test.go:448: /multipost/parallel/foo: unexpected body: {"first":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Host":["localhost:8540"]},"method":"POST","url":"/provider/foo"},"second":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Host":["localhost:8540"]},"method":"POST","url":"/recipient/foo"}}
/multipost/parallel/foo was expecting: {"first":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":[""],"X-Forwarded-Host":["localhost:8540"]},"method":"POST","url":"/provider/foo"},"second":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":[""],"X-Forwarded-Host":["localhost:8540"]},"method":"POST","url":"/recipient/foo"}}
--- FAIL: TestKrakenD_negroniRouter/multipost_sequential (0.00s)
integration_test.go:448: /multipost/sequential/foo: unexpected body: {"first":{"path":"/provider/foo","random":42},"second":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Host":["localhost:8540"]},"method":"POST","url":"/recipient/42"},"third":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Host":["localhost:8540"]},"method":"POST","url":"/recipient/42"}}
/multipost/sequential/foo was expecting: {"first":{"path":"/provider/foo","random":42},"second":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":[""],"X-Forwarded-Host":["localhost:8540"]},"method":"POST","url":"/recipient/42"},"third":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":[""],"X-Forwarded-Host":["localhost:8540"]},"method":"POST","url":"/recipient/42"}}
--- FAIL: TestKrakenD_httptreemuxRouter (0.42s)
--- FAIL: TestKrakenD_httptreemuxRouter/multipost_parallel (0.00s)
integration_test.go:448: /multipost/parallel/foo: unexpected body: {"first":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Host":["localhost:9899"]},"method":"POST","url":"/provider/foo"},"second":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Host":["localhost:9899"]},"method":"POST","url":"/recipient/foo"}}
/multipost/parallel/foo was expecting: {"first":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":[""],"X-Forwarded-Host":["localhost:9899"]},"method":"POST","url":"/provider/foo"},"second":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":[""],"X-Forwarded-Host":["localhost:9899"]},"method":"POST","url":"/recipient/foo"}}
--- FAIL: TestKrakenD_httptreemuxRouter/multipost_sequential (0.00s)
integration_test.go:448: /multipost/sequential/foo: unexpected body: {"first":{"path":"/provider/foo","random":42},"second":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Host":["localhost:9899"]},"method":"POST","url":"/recipient/42"},"third":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Host":["localhost:9899"]},"method":"POST","url":"/recipient/42"}}
/multipost/sequential/foo was expecting: {"first":{"path":"/provider/foo","random":42},"second":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":[""],"X-Forwarded-Host":["localhost:9899"]},"method":"POST","url":"/recipient/42"},"third":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":[""],"X-Forwarded-Host":["localhost:9899"]},"method":"POST","url":"/recipient/42"}}
2025/03/19 18:32:44 "GET http://localhost:8924/static HTTP/1.1" from 127.0.0.1:54435 - 200 25B in 815.333µs
2025/03/19 18:32:44 "POST http://localhost:8924/param_forwarding/foo/constant/bar HTTP/1.1" from 127.0.0.1:54435 - 200 19B in 836.459µs
2025/03/19 18:32:44 "POST http://localhost:8924/param_forwarding/foo/constant/foobar HTTP/1.1" from 127.0.0.1:54435 - 200 22B in 220.458µs
2025/03/19 18:32:44 "GET http://localhost:8924/timeout HTTP/1.1" from 127.0.0.1:54435 - 200 37B in 85.609333ms
2025/03/19 18:32:44 "GET http://localhost:8924/partial/static HTTP/1.1" from 127.0.0.1:54435 - 200 61B in 590.291µs
2025/03/19 18:32:44 "GET http://localhost:8924/partial HTTP/1.1" from 127.0.0.1:54435 - 200 37B in 344.709µs
2025/03/19 18:32:44 "GET http://localhost:8924/combination HTTP/1.1" from 127.0.0.1:54435 - 200 148B in 346.875µs
2025/03/19 18:32:44 "GET http://localhost:8924/detail_error HTTP/1.1" from 127.0.0.1:54435 - 200 155B in 332.292µs
2025/03/19 18:32:44 "GET http://localhost:8924/querystring-params-test/no-params?a=1&b=2&c=3 HTTP/1.1" from 127.0.0.1:54435 - 200 152B in 273.417µs
2025/03/19 18:32:44 "GET http://localhost:8924/querystring-params-test/query-params?a=1&b=2&c=3 HTTP/1.1" from 127.0.0.1:54435 - 200 174B in 146.5µs
2025/03/19 18:32:44 "GET http://localhost:8924/querystring-params-test/url-params/some?a=1&b=2&c=3 HTTP/1.1" from 127.0.0.1:54435 - 200 165B in 152.375µs
2025/03/19 18:32:44 "GET http://localhost:8924/querystring-params-test/all-params?a=1&b=2&c=3 HTTP/1.1" from 127.0.0.1:54435 - 200 182B in 135.416µs
2025/03/19 18:32:44 "GET http://localhost:8924/header-params-test/no-params HTTP/1.1" from 127.0.0.1:54435 - 200 152B in 127.792µs
2025/03/19 18:32:44 "GET http://localhost:8924/header-params-test/filter-params HTTP/1.1" from 127.0.0.1:54435 - 200 176B in 135.583µs
2025/03/19 18:32:44 "GET http://localhost:8924/header-params-test/all-params HTTP/1.1" from 127.0.0.1:54435 - 200 228B in 143.917µs
2025/03/19 18:32:44 "GET http://localhost:8924/sequential/ok/foo HTTP/1.1" from 127.0.0.1:54435 - 200 92B in 502.208µs
2025/03/19 18:32:44 "GET http://localhost:8924/sequential/ko/first/foo HTTP/1.1" from 127.0.0.1:54435 - 500 20B in 148.75µs
2025/03/19 18:32:44 "GET http://localhost:8924/sequential/ko/last/foo HTTP/1.1" from 127.0.0.1:54446 - 200 13B in 590.125µs
2025/03/19 18:32:44 "GET http://localhost:8924/redirect HTTP/1.1" from 127.0.0.1:54446 - 200 24B in 531.667µs
2025/03/19 18:32:44 "GET http://localhost:8924/found HTTP/1.1" from 127.0.0.1:54446 - 200 24B in 532.083µs
2025/03/19 18:32:44 "GET http://localhost:8924/flatmap/delete HTTP/1.1" from 127.0.0.1:54446 - 200 70B in 185.916µs
2025/03/19 18:32:44 "GET http://localhost:8924/flatmap/rename HTTP/1.1" from 127.0.0.1:54446 - 200 120B in 166.917µs
2025/03/19 18:32:44 "GET http://localhost:8924/x-forwarded-for HTTP/1.1" from 127.0.0.1:54446 - 200 156B in 369.084µs
2025/03/19 18:32:44 "PUT http://localhost:8924/sequence-accept HTTP/1.1" from 127.0.0.1:54446 - 200 37B in 267.542µs
2025/03/19 18:32:44 "GET http://localhost:8924/error-status-code/1 HTTP/1.1" from 127.0.0.1:54451 - 200 37B in 149.875µs
2025/03/19 18:32:44 "GET http://localhost:8924/error-status-code/2 HTTP/1.1" from 127.0.0.1:54452 - 429 11B in 329.459µs
2025/03/19 18:32:44 "GET http://localhost:8924/error-status-code/3 HTTP/1.1" from 127.0.0.1:54454 - 200 37B in 290.584µs
2025/03/19 18:32:44 "POST http://localhost:8924/multipost/parallel/foo HTTP/1.1" from 127.0.0.1:54455 - 200 457B in 582.625µs
2025/03/19 18:32:44 "POST http://localhost:8924/multipost/sequential/foo HTTP/1.1" from 127.0.0.1:54455 - 200 501B in 628.125µs
--- FAIL: TestKrakenD_chiRouter (0.42s)
--- FAIL: TestKrakenD_chiRouter/multipost_parallel (0.00s)
integration_test.go:448: /multipost/parallel/foo: unexpected body: {"first":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Host":["localhost:8924"]},"method":"POST","url":"/provider/foo"},"second":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Host":["localhost:8924"]},"method":"POST","url":"/recipient/foo"}}
/multipost/parallel/foo was expecting: {"first":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":[""],"X-Forwarded-Host":["localhost:8924"]},"method":"POST","url":"/provider/foo"},"second":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":[""],"X-Forwarded-Host":["localhost:8924"]},"method":"POST","url":"/recipient/foo"}}
--- FAIL: TestKrakenD_chiRouter/multipost_sequential (0.00s)
integration_test.go:448: /multipost/sequential/foo: unexpected body: {"first":{"path":"/provider/foo","random":42},"second":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Host":["localhost:8924"]},"method":"POST","url":"/recipient/42"},"third":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Host":["localhost:8924"]},"method":"POST","url":"/recipient/42"}}
/multipost/sequential/foo was expecting: {"first":{"path":"/provider/foo","random":42},"second":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":[""],"X-Forwarded-Host":["localhost:8924"]},"method":"POST","url":"/recipient/42"},"third":{"body":"{\"foo\":\"bar\"}","headers":{"Accept-Encoding":["gzip"],"User-Agent":["KrakenD Version undefined"],"X-Forwarded-For":[""],"X-Forwarded-Host":["localhost:8924"]},"method":"POST","url":"/recipient/42"}}
FAIL
FAIL github.com/luraproject/lura/v2/test 3.260s
FAIL
Metadata
Metadata
Assignees
Labels
No labels