Skip to content

Conversation

@wangfeng22
Copy link

Description

Fixes #8195

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

Copy link
Contributor

@tokers tokers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need test cases to cover the changes.

@wangfeng22
Copy link
Author

Need test cases to cover the changes.

@tokers It's similar to #4260, and I don't know how to write test cases.

@tzssangglass
Copy link
Member

@tokers It's similar to #4260, and I don't know how to write test cases.

read more: https://github.com/apache/apisix/blob/master/docs/en/latest/plugin-develop.md#write-test-case

@wangfeng22
Copy link
Author

@tokers It's similar to #4260, and I don't know how to write test cases.

read more: https://github.com/apache/apisix/blob/master/docs/en/latest/plugin-develop.md#write-test-case

@tzssangglass The test tool does not meet the testing needs, because the realip_remote_addr in the returned header is dynamic.

@tzssangglass
Copy link
Member

@tzssangglass The test tool does not meet the testing needs, because the realip_remote_addr in the returned header is dynamic.

we can change:

if ($http_x_forwarded_for != "") {
set $var_x_forwarded_for "${http_x_forwarded_for}, ${realip_remote_addr}";
}
and

apisix/t/APISIX.pm

Lines 771 to 773 in 024e0ef

if (\$http_x_forwarded_for != "") {
set \$var_x_forwarded_for "\${http_x_forwarded_for}, \${realip_remote_addr}";
}

@tzssangglass
Copy link
Member

you can learn from: https://github.com/apache/apisix/pull/8200/files

@wangfeng22
Copy link
Author

you can learn from: https://github.com/apache/apisix/pull/8200/files

@tzssangglass Thank you very much. I have added some test cases.

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.

bug: proxy-rewrite X-Forwarded-For doesn't work.

3 participants