Welcome! Log In Create A New Profile

Advanced

Proxying with multiple "tiers" of sources

Posted by UsernameNumber 
Proxying with multiple "tiers" of sources
December 28, 2014 07:21PM
Hello all!

I work with a group of nonprofits collaborating on a project to make educational resources available to places with little or no bandwidth by hosting things like wikipedia content, MOOCs, etc on a small local server that can act as a WAP, content server, etc with or without (or with unreliable) access to the outside world.

I'm completely new to nginx, but from what I've read, I think it could help us add some much-needed flexibility to our setup (more on that below). In addition to the nginx docs, I've searched this forum and the wiki and have found evidence that what I want to do might be possible, but nothing as concrete as I'd like, so I'm hoping I can appeal to the more experienced folks on this list to take a few minutes for a good cause and help me out with a sanity check and advice before I dive headlong into implementation.

Here's some background and a quick sketch of what I'd like to do:

In a 100% offline scenario, things are pretty straightforward: create a portal page with links to the available content and have iptables redirect all requests that would normally go through the WAP to the web service hosting the portal page instead.

Things get more complicated if you have sporadic net access, or expensive bandwidth such that you just need to favor locally-hosted alternatives. My dream setup is one where all http(s) requests that go through the WAP are redirected to one of the following, in order of preference:
1. The corresponding local content, if present
2. The requested remote content, if present and there is internet access
- bonus points for caching along the way
- ...and also for having a switch we can flip to not bother with this step if we know there's no Internet
3. A default catch-all page if all else fails

I've sketched out what I'm trying to do in a bit more detail in the flowchart at the bottom of this page on one of our project wikis: https://github.com/tunapanda/provision/wiki/%22smart-proxy%22-proposal-and-brainstorming

As noted there, my current thinking is that I could create a site in nginx for each of the fallback "tiers" described above, with tiers 1 and 2 configured with proxy_intercept_errors and error_page settings to redirect to the next tier down.

So, to sum up... does this sound sane? Is what I'm trying to do possible? If so, is it covered in any documentation? If not, am I at least on the right track?

Any assistance folks can offer would be greatly appreciated!
Re: Proxying with multiple "tiers" of sources
December 29, 2014 06:23AM
I would not use a cache like normal caching would be used but use a mirror of pages, something like squid behind nginx.

---
nginx for Windows http://nginx-win.ecsds.eu/
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 116
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready