Route content using nginx if a specific condition is met

I have 2 LAN networks which are united w/ IPSec tunnel:

  1. 10.10.10.1/24
  2. 10.10.20.1/24

One of my internal sites is running on 10.10.10.50, which is serving users heavy content, such as 300-400MB archives, it takes really long for .20.1/24 users to retrieve the content. The site itself is accessed via WAN for 20.1/24

I’ve synced the whole content to a server located on 20.1/24 to decrease the downtime.

My question here is: How can I route users from 20.1/24, to be able to download content from 2nd server which is on 20.1/24

To visualise, it will look like this:

       .20.1/24? - > Download from 20.1/24 server
WAN - /
      \.10.1/24? - > Download from 10.1/24 server  

I’m not including NAT questions, because this is another topic. But to clear things up – I thing that the rules will be based on both networks WAN ip’s.

Answer

Attribution
Source : Link , Question Author : falken , Answer Author : Community

Leave a Comment