hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

fix(core): use `realip_remote_addr` function to extract ip address

Open Narayanbhat166 opened this issue 1 year ago • 0 comments

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

Narayanbhat166 avatar May 15 '24 13:05 Narayanbhat166