An introduction to web cache proxy server - nuster

  •        0

We aggregate and tag open source projects. We have collections of more than one million projects. Check out the projects section.

An introduction to web cache proxy server - nuster

Nuster is a simple yet powerful web caching proxy server based on HAProxy. It is 100% compatible with HAProxy, and takes full advantage of the ACL functionality of HAProxy to provide fine-grained caching policy based on the content of request, response or server status. This article gives an overview of nuster - web cache proxy server, its installation and few examples of how to use it.

Its features include:

  • All features of HAProxy are inherited, 100% compatible with HAProxy
  • Powerful dynamic cache ability
    • Based on HTTP method, URI, path, query, header, cookies, etc
    • Based on HTTP request or response contents, etc
    • Based on environment variables, server state, etc
    • Based on SSL version, SNI, etc
    • Based on connection rate, number, byte, etc
  • Extremely fast
  • Cache purging
  • HTTPS supports on both frontend and backend
  • HTTP compression
  • HTTP rewriting and redirection



make TARGET=linux2628 USE_LUA=1 LUA_INC=/usr/include/lua5.3 USE_OPENSSL=1 USE_PCRE=1 USE_ZLIB=1
make install PREFIX=/usr/local/nuster/bin
TARGET: linux2628, linux26, linux24, linux24e, linux22, solaris, freebsd, openbsd, cygwin, custom, generic
docker pull nuster/nuster
docker run -d -v /path/to/nuster.cfg:/etc/nuster/nuster.cfg:ro -p 8080:8080 nuster/nuster

Minimal config file:

Section description: 

  • global: global parameters
  • defaults: default parameters for proxy section
  • frontend: parameter for frontend which accept requests from client
  • backend: forward requests to backend servers
  • listen: combine frontend and backend


    cache on
    nbproc 2
    retries 3
    option redispatch
    option dontlognull
    timeout client  300s
    timeout connect 300s
    timeout server  300s
frontend web1
    bind *:8080
    mode http
    default_backend app1
backend app1
    balance roundrobin
    mode http
    filter cache
    cache-rule all ttl 0
    server s1
    server s2
    server s3


Set cache on in global

Set filter cache and cache-rule in backend 

        /usr/local/nuster/bin/haproxy -f nuster.conf
        As a TCP Load Balancer:
frontend mysql-lb
   bind *:3306
   mode tcp
   default_backend mysql-cluster
backend mysql-cluster
   balance roundrobin
   mode tcp
   server s1
   server s2
   server s3 

As HTTP Load Balancer:

frontend web-lb
   bind *:80
   mode http
   default_backend apps
backend apps
   balance roundrobin
   mode http
   server s1
   server s2
   server s3

As HTTPS Load Balancer:

frontend web
    bind *:8080 ssl crt XXX.pem
    # bind *:8080
    mode http
    default_backend app
backend app
    balance roundrobin
    filter cache off
    cache-rule all
    mode http
    #server a1
    server a2 ssl verify none

Web caching

frontend web1
    bind *:8080
    mode http
    use_backend app1a if { path /search }
    default_backend app1b
backend app1a
    balance roundrobin
    mode http
    option http-buffer-request
    filter cache
    cache-rule rpost ttl 60 if METH_POST
backend app1b

cache /a.jpg, no expire

cache-rule r1 ttl 0 if { path /a.jpg }

cache static files
acl static path_beg -i /static/ /images/ /css/
cache-rule static_files ttl 0 if static

cache /mypage, using sessionId cookie
acl pathB path /mypage
cache-rule r2 key ttl 60 if pathB
cache /a.html if response header contains cache
http-request set-var(txn.pathC) path
acl pathC var(txn.pathC) -m str /a.html
acl resHdrCache1 res.hdr(cache) yes
cache-rule r3 if pathC resHdrCache1
cache /heavy for 100 seconds if there are more than 100 connections
acl heavypage path /heavy
acl tooFast be_conn ge 100
cache-rule heavy ttl 100 if heavypage tooFast
Add header before cache
http-response set-header X-ASDF fdsa
Compress before cache
backend app
  filter compression
  compression algo gzip
  compression type text/html text/plain text/css text/javascript
  filter cache
  cache-rule all
Purging cache
curl -XPURGE
If you define cache purge-method MYPURGE in global, you can use



Related Articles

Should web application store images in Database or File system?

  • database image-store filesystem

Web developers most frequent question, Should user images be stored in database or file system? Which is the best way. Both has some pros and cons.

Read More

Univention Corporate Server - An open source identity management system

  • ucs identity-management-system

Univention Corporate Server is an open source identity management system, an IT infrastructure and device management solution and an extensible platform with a store-like App Center that includes tested third party applications and further UCS components: This is what Univention combines in their main product Univention Corporate Server, a Debian GNU/Linux based enterprise distribution. This article provides you the overview of Univention Corporate Server, its feature and installation.

Read More

Lucene Vs Solr

  • searchengine lucene solr

Lucene is a search library built in Java. Solr is a web application built on top of Lucene. Certainly Solr = Lucene + Added features. Often there would a question, when to choose Solr and when to choose Lucene.

Read More – The First Multithreaded Application Server for PHP written in PHP

  • appserver application-server php

What if you could reliably run PHP without Nginx or Apache, but also without relying on its internal server? What if you could do async operations in PHP with true multi threading, fully taking advantage of multi core processors without hacks or a jungle of callbacks? What if you had drag and drop installation support for your PHAR packaged web apps in an environment identical to its production counterpart? Welcome to – the worlds first open source application server for PHP.

Read More

LogicalDOC - Open Source DMS

  • dms document-management-system

LogicalDOC is both a document management and a collaboration system. The software is loaded with many functions and allows organizing, indexing, retrieving, controlling and distributing important business documents securely and safely for any organization and individual.

Read More

Scale up vs Scale out. First decision to make before moving to cloud

  • cloud scale-up scale-out scalability

Before moving to cloud, First decision to make is whether Scale up the hardware or Scale out with multiple systems. Both has its pros and cons.

Read More

SeoToaster: easy, fast and efficient open source CMS for top SEO performance

  • cms content-management-system seo ecommerce

SeoToaster is a free Open Source CMS & Ecommerce solution to build, manage and market websites optimized for for top search engine performance. As the name implies, Seo Toaster is to date the only content management system (CMS) to truly integrate SEO execution and web marketing automation technology in full compliance with the search engines industry’s best practices.

Read More

AbanteCart - Easy to use open source e-commerce platform, helps selling online

  • e-commerce ecommerce cart

AbanteCart is a free, open source shopping cart that was built by developers with a passion for free and accessible software. Founded in 2010 (launched in 2011), the platform is coded in PHP and supports MySQL. AbanteCart’s easy to use admin and basic layout management tool make this open source solution both easy to use and customizable, depending on the skills of the user. AbanteCart is very user-friendly, it is entirely possible for a user with little to no coding experience to set up and use this cart. If the user would be limited to the themes and features available in base AbanteCart, there is a marketplace where third-party extensions or plugins come to the rescue.

Read More

PrestaShop - A feature rich Open Source eCommerce solution

PrestaShop is an Open Source eCommerce Solution. It comes complete with over 310 features that have been carefully developed to assist business owners in increasing sales with virtually little effort. It is being used in more than 150,000 online stores.

Read More

Top 15 Open source alternative to Microsoft products

  • microsoft-alternative open-source-enterprise

Microsoft is monopoly in the commercial software. Here are 15 best alternatives to most popular and widely used Microsoft products.

Read More

10 sites to get the large data set or data corpus for free

  • search test-data large-data-set data-corpus dataset

You may require GBs of data to do performance or load testing. How your app behaves when there is loads of data. You need to know the capacity of your application. This is the frequently asked question from the sales team "The customer is having 100GB of data and he wants to know whether our product will handle this? If so how much RAM / Disk storage required?". This article has pointers to the large data corpus.

Read More

10 Free services for your Website / Blog. Just plug it.

  • free website blog free-service free-resources

Each website / blog delivers useful content or service to its users. But website themselves requires some service to monitor and increase its presence. Here are few free services which could be used by Website / Blog. This will be very much helpful for small business owners.

Read More

GreenMail - Email Test Framework in Java

  • email email-server test automation

In any project there will be a need to send mail out to users. It could be an alert mail, forget password or authentication related mail. Mail is the default communication between the software and the users. As a developer, we can write code, to send out a mail but we need to make sure whether it got successfully received and how the body of mail, Is it the same like what we have sent. GreenMail is a Email test framework which helps to send and receive mails. It is a test framework which supports SMTP, POP3, IMAP including SSL.

Read More

Is ZooKeeper mandatory for Cloud

  • zookeeper distributed cloud

Cloud is nothing but more than one system or application distributed across the network, across the globe. It may have couple of application servers, database server, shared data storage, backup server and lot more. The resources in the distributed environment must have information about each other so that they could co-ordinate and share without any issues. ZooKeeper helps to do that.

Read More

8 Best Open Source Searchengines built on top of Lucene

  • lucene solr searchengine elasticsearch

Lucene is most powerful and widely used Search engine. Here is the list of 7 search engines which is built on top of Lucene. You could imagine how powerful they are.

Read More

Where should i host my open source code?

  • code-hosting open-source code hosting

I have a open source project but where should i host? This is the frequently asked question among developers. Below details will certainly help to choose the best code hosting site.

Read More

Web based commenting system. Embed directly in to your site

  • comment free commenting-system

Comments are very important for a blog or website to get feedback from their users. Comments could be threaded where users could be discuss and post reply to the comment. Here we going discuss about the most popular and widely used free commenting system. You need to embed their javascript code in your every page and it will take care the rest of the task.

Read More

How to solve CommunicationsException in Java while using Hibernate and MySQL

  • java hibernate mysql communicationsexception timeout

You might have faced CommunicationsException, basically timeout issue in Java while connecting to MySQL using Hibernate. The session would be timed out after certain period of time. You might be thinking that the your site or application is running without any issue but it would have stopped or crashed due to exception.

Read More

Restrict Solr Admin Access

  • solr searchengine tips

Solr is a search engine built on top of Lucene. It supports REST interface and has lot of built-in capabilities. Solr package has Admin UI interface which has support to perform query and even delete the contents of the index. If you are using Solr in production then you may need to restrict access. I saw couple of questions in the group related to this topic. Thought to write an article explaining few tips to restrict the user access to Solr admin UI.

Read More

Whats new in Lucene / Solr 4.0

  • lucene solr new-release

The release 4.0 is one of the important milestone for Lucene and Solr. It has lot of new features and performance important. Few important ones are highliggted in this article.

Read More

We have large collection of open source products. Follow the tags from Tag Cloud >>

Open source products are scattered around the web. Please provide information about the open source projects you own / you use. Add Projects.