Closed ymc-dabe closed 1 year ago
Hi @ymc-dabe
Thank you for your issue, I'm very glad that you are interested in my plugin and have made valuable suggestions. :)
I have added the support of parsing IP addresses with port numbers, and now the plugin can identify IP address in the following formats regardless of whether they have port numbers:
x.x.x.x
x.x.x.x, y.y.y.y
so you can use the following configuration to support the CloudFront-Viewer-Address
header in v1.0.3
:
# CloudFront-Viewer-Address: IP:PORT
- proxyHeadername: X-From-Cdn
proxyHeadervalue: cf-foo
realIP: CloudFront-Viewer-Address
Please try the new version, if you have any questions or feedback, please feel free to contact me. Thank you again for your support and contribution! 🙏
Hi @Paxxs
I just wanted to let you know, that this works like a charm. Thanks a lot and sorry for not providing a timely feedback.
Hi @Paxxs
Would it be possible to add support for the header
CloudFront-Viewer-Address
, which AWS CloudFront is using? It is in the formatCloudFront-Viewer-Address: IP:PORT
- e.g.:CloudFront-Viewer-Address: 192.0.2.99:4321
AWS documents this here: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/adding-cloudfront-headers.html
It should be rather easy to add support for this with the function
net.SplitHostPort()
, which already is used in your plugin's code (for the headerRemoteAddr
). Maybe it would be an idea to always split out the port from the IP (and not just forRemoteAddr
and potentiallyCloudFront-Viewer-Address
).Thanks a lot for the plugin for your plugin and your continued support for it.