Commit d9bcd6d
authored
Fix client IP address detection to show real user IP instead of AppGateway internal IP (#828)
### Summary & Motivation
Fix the Sessions dialog showing the AppGateway's internal IP address
(e.g., `10.0.0.54`) instead of the user's real public IP address. This
regression was introduced in commit `c67bdac` which added YARP's
`AddXForwarded` transform.
- Remove YARP's `AddXForwarded()` transform from AppGateway, which was
replacing the original `X-Forwarded-For` header set by Azure Container
Apps ingress
- Update `HttpExecutionContext.ClientIpAddress` to read the
`X-Forwarded-For` header directly and extract the first IP address (the
original client), with a fallback to `RemoteIpAddress` for local
development
The previous approach relied on `UseForwardedHeaders` middleware
processing the header correctly across multiple proxy hops, but YARP's
`AddXForwarded` transform was overwriting the header with the wrong IP
before it reached the backend API.
### Checklist
- [x] I have added tests, or done manual regression tests
- [x] I have updated the documentation, if necessary2 files changed
+13
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| |||
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 16 | + | |
23 | 17 | | |
24 | 18 | | |
25 | 19 | | |
| |||
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
43 | 54 | | |
44 | 55 | | |
45 | 56 | | |
| |||
0 commit comments