hyperswitch
hyperswitch copied to clipboard
fix(core): use `realip_remote_addr` function to extract ip address
Type of Change
- [x] Bugfix
Description
Previously we were relying on the X_FORWARDED_FOR header value for extracting the ip address. This value would be available if there were proxies that populate this value. But if this has been done from the localhost or if there were no reverse proxies behind the application, then this header value would not be present. This has been fixed in this PR.
We are using the realip_remote_addr function to extract the ip address from the request. This will look for the X_FORWARDED_FOR header, if not found, fallback to the socket ip address.
Motivation and Context
How did you test it?
- Confirm a payment and then check for the log line
Checklist
- [x] I formatted the code
cargo +nightly fmt --all - [x] I addressed lints thrown by
cargo clippy - [x] I reviewed the submitted code