# Routing from VPN to local web application

**URL:** <https://forum.pritunl.com/t/routing-from-vpn-to-local-web-application/1512>\
**Category:** Pritunl VPN\
**Tags:** pritunl\
**Created:** [October 25, 2023, 4:38pm UTC](https://forum.pritunl.com/t/routing-from-vpn-to-local-web-application/1512 "2023-10-25T16:38:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![b.kasymov\_wegotrip](https://forum.pritunl.com/letter_avatar_proxy/v4/letter/b/bcef8e/32.png) [@b.kasymov\_wegotrip](https://forum.pritunl.com/u/b.kasymov_wegotrip)\
**Post date:** [October 25, 2023, 4:38pm UTC](https://forum.pritunl.com/t/routing-from-vpn-to-local-web-application/1512/1 "2023-10-25T16:38:53Z")

</div>

Hello,

I’ve recently set up PritunlVPN and a staging web application on the same server. To enhance security, I want to restrict access to the web application based on IP addresses.

Previously, the web application was safeguarded using Nginx’s basic authentication. Now, I aim to limit access using IP restrictions. I’ve configured Nginx to allow access only from the VPN server’s IP address, but the web application still detects my original IP rather than the VPN server’s IP.

Essentially, I’d like to ensure that I can access the web application only through the VPN, given that both the VPN and the web application are on the same server.

Could you guide me on how to configure this properly?

Thank you in advance for your assistance.

---

<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:** [October 27, 2023, 10:54am UTC](https://forum.pritunl.com/t/routing-from-vpn-to-local-web-application/1512/2 "2023-10-27T10:54:38Z")

</div>

The IP address of the web application will need to be added to the VPN server routes or the `0.0.0.0/0` to route all public internet traffic.

---

<div class="post-metadata">

**Author:** ![b.kasymov\_wegotrip](https://forum.pritunl.com/letter_avatar_proxy/v4/letter/b/bcef8e/32.png) [@b.kasymov\_wegotrip](https://forum.pritunl.com/u/b.kasymov_wegotrip)\
**Post date:** [October 27, 2023, 2:10pm UTC](https://forum.pritunl.com/t/routing-from-vpn-to-local-web-application/1512/3 "2023-10-27T14:10:16Z")

</div>

0.0.0.0/0 has already added for route all public internet traffic.  
I’ve added IP address of application, it does not work too.

---

<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:** [October 27, 2023, 7:20pm UTC](https://forum.pritunl.com/t/routing-from-vpn-to-local-web-application/1512/4 "2023-10-27T19:20:54Z")

</div>

If the server has an enterprise subscription verify the route has NAT enabled, if there is no subscription NAT will be enabled by default. Run `tracepath` with the web application IP address to verify the traffic is going through the VPN server.
