# Update X-Forwarded-For in Okta Push

**URL:** <https://forum.pritunl.com/t/update-x-forwarded-for-in-okta-push/950>\
**Category:** Pritunl VPN\
**Tags:** pritunl\
**Created:** [April 12, 2023, 4:51pm UTC](https://forum.pritunl.com/t/update-x-forwarded-for-in-okta-push/950 "2023-04-12T16:51:31Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![harrisonjohn](https://forum.pritunl.com/user_avatar/forum.pritunl.com/harrisonjohn/32/353_2.png) [@harrisonjohn](https://forum.pritunl.com/u/harrisonjohn)\
**Post date:** [April 12, 2023, 4:51pm UTC](https://forum.pritunl.com/t/update-x-forwarded-for-in-okta-push/950/1 "2023-04-12T16:51:31Z")

</div>

@zach The latest update in 1.32.3498.90 for the user-agent is awesome. Thank you!

It looks like the `x-forwarded-for` address if pulling a variable called `remote_ip` defined in authorizer.py perhaps. With our server hosted in AWS us-west-2 (oregon) the location in the Okta Push is misleading. Is it possible to update this value to be the requesting users public IP?

 ![vpn](https://forum-static.pritunl.com/original/1X/125fc0bbfd68b9fc1a807b53be9b89a00f008897.jpeg)

---

<div class="post-metadata">

**Author:** ![zach](https://forum.pritunl.com/user_avatar/forum.pritunl.com/zach/32/1105_2.png) [@zach](https://forum.pritunl.com/u/zach)\
**Post date:** [April 13, 2023, 2:41pm UTC](https://forum.pritunl.com/t/update-x-forwarded-for-in-okta-push/950/2 "2023-04-13T14:41:48Z")

</div>

The remote IP is set to the clients IP address. If a load balancer is used the [**load balancing documentation**](https://docs.pritunl.com/docs/load-balancing) has information on using the load balancer forwarded address.

---

<div class="post-metadata">

**Author:** ![harrisonjohn](https://forum.pritunl.com/user_avatar/forum.pritunl.com/harrisonjohn/32/353_2.png) [@harrisonjohn](https://forum.pritunl.com/u/harrisonjohn)\
**Post date:** [April 13, 2023, 5:57pm UTC](https://forum.pritunl.com/t/update-x-forwarded-for-in-okta-push/950/3 "2023-04-13T17:57:58Z")

</div>

Hey @zach – We don’t use a load balancer but it seems like the IP in the connection log is correct, but that is not what is passed to the api call in okta.py.

In my screenshot, The greyed out section is my actual IP:

 ![Screenshot 2023-04-13 at 10.45.11](https://forum-static.pritunl.com/original/1X/83ace259588c781fe64275997185951a22443a7b.png)

But when I initiate the push it shows a different IP/location.

I can verify that this works by manually making an API call to okta verify push. If I set that `63.81...` address in the X-Forwarded-For, it sets the correct location.

 ![vpn_2](https://forum-static.pritunl.com/original/1X/15e2de0db7159aeefae555f2e76c9c7972bc505c.jpeg)

---

<div class="post-metadata">

**Author:** ![zach](https://forum.pritunl.com/user_avatar/forum.pritunl.com/zach/32/1105_2.png) [@zach](https://forum.pritunl.com/u/zach)\
**Post date:** [April 13, 2023, 6:25pm UTC](https://forum.pritunl.com/t/update-x-forwarded-for-in-okta-push/950/4 "2023-04-13T18:25:31Z")

</div>

A lot of connection methods will use HTTPS requests before the OpenVPN connection such as single sign-on connection authentication. The IP address would be obtained from that request not the VPN connection.

---

<div class="post-metadata">

**Author:** ![harrisonjohn](https://forum.pritunl.com/user_avatar/forum.pritunl.com/harrisonjohn/32/353_2.png) [@harrisonjohn](https://forum.pritunl.com/u/harrisonjohn)\
**Post date:** [April 13, 2023, 6:33pm UTC](https://forum.pritunl.com/t/update-x-forwarded-for-in-okta-push/950/5 "2023-04-13T18:33:45Z")

</div>

Got it. So is there anything I can do here to update that value?

---

<div class="post-metadata">

**Author:** ![zach](https://forum.pritunl.com/user_avatar/forum.pritunl.com/zach/32/1105_2.png) [@zach](https://forum.pritunl.com/u/zach)\
**Post date:** [April 13, 2023, 6:51pm UTC](https://forum.pritunl.com/t/update-x-forwarded-for-in-okta-push/950/6 "2023-04-13T18:51:10Z")

</div>

I will try reproducing the issue. I believe the header stopped working a while ago. You can try editing `/usr/lib/pritunl/lib/python3.8/site-packages/pritunl/sso/okta.py` and modifying the header to verify it isn’t an issue with sending the wrong address.

---

<div class="post-metadata">

**Author:** ![harrisonjohn](https://forum.pritunl.com/user_avatar/forum.pritunl.com/harrisonjohn/32/353_2.png) [@harrisonjohn](https://forum.pritunl.com/u/harrisonjohn)\
**Post date:** [April 13, 2023, 7:35pm UTC](https://forum.pritunl.com/t/update-x-forwarded-for-in-okta-push/950/7 "2023-04-13T19:35:10Z")

</div>

Thanks @zach this is interesting. When I go into that py file and add `'X-Forwarded-For': '63.81.xx.xx'` restart the service, it doesn’t pick it up and still uses the Oregon IP.

---

<div class="post-metadata">

**Author:** ![zach](https://forum.pritunl.com/user_avatar/forum.pritunl.com/zach/32/1105_2.png) [@zach](https://forum.pritunl.com/u/zach)\
**Post date:** [April 13, 2023, 10:38pm UTC](https://forum.pritunl.com/t/update-x-forwarded-for-in-okta-push/950/8 "2023-04-13T22:38:23Z")

</div>

When you are making the API call manually that is likely using the IP address of that computer. The issue will likely need to be fixed by Okta to use the header.

---

<div class="post-metadata">

**Author:** ![fmalykh](https://forum.pritunl.com/user_avatar/forum.pritunl.com/fmalykh/32/252_2.png) [@fmalykh](https://forum.pritunl.com/u/fmalykh)\
**Post date:** [April 14, 2023, 8:41am UTC](https://forum.pritunl.com/t/update-x-forwarded-for-in-okta-push/950/9 "2023-04-14T08:41:27Z")

</div>

Try adding pritunl public IP as a Trusted proxy IPs in Okta admin settings:  
Okta → Security → Networks  
This does work well for us.

---

<div class="post-metadata">

**Author:** ![harrisonjohn](https://forum.pritunl.com/user_avatar/forum.pritunl.com/harrisonjohn/32/353_2.png) [@harrisonjohn](https://forum.pritunl.com/u/harrisonjohn)\
**Post date:** [April 14, 2023, 2:32pm UTC](https://forum.pritunl.com/t/update-x-forwarded-for-in-okta-push/950/10 "2023-04-14T14:32:05Z")

</div>

Hey @fmalykh – yeah at first test, this seems to work 🙂 thanks for the tip!
