Home Blog Page 2

Varnish Cache Based on Device Type

varnish Device

Varnish Cache is a web application accelerator also known as a caching HTTP reverse proxy. Varnish Cache allows you to cache server request efficiently and improve server performance.

varnish Device

Serving content customized for the requesting device

Without additional configuration, Varnish will return the only version of a resource that it has cached for a particular URL — regardless of its appropriateness for the device

performing the request. This can be problematic. For example, if a mobile phone performs the first request for a resource, the request may return specific mobile content, and Varnish will likely cache it

Device detection is figuring out what kind of content to serve to a client based on the User-Agent string supplied in a request. It’s trivial and only a slight modification of default vcl configuration – to start considering user agent in cache key hash so that pages would be cached separately. Adding literal user agent value to cache key would just explode it though – there are so many variations of it’s value. To solve it we can create method, which would normalize it

sub initialize_useragent {
    if (req.http.user-agent ~ "Mobile|iPhone|Android") {
        set req.http.X-UserAgent = "mobile";
    } else {
        set req.http.X-UserAgent = "desktop";

We could later add this normalized value in cache key hash generation as below. But this approach has one challenge that static content which doesn’t change based on device typed are hashed differently and resulting in increase in cache size and reduction cache hit rate.

# The data on which the hashing will take place
sub vcl_hash {

        # Hashing based on Device(Mobile/Desktop) 
        call initialize_useragent; 

        return (lookup);

This could easily solved by skipping Device Specific Hash addition for particular content based on requested URL parameter.

# The data on which the hashing will take place
sub vcl_hash {

        # Hashing based on Device(Mobile/Desktop) but skip for static content
        call initialize_useragent; 
        if (!(req.url ~ "\.(css|js|png|gif|jp(e?)g)|swf|ico") ){
        return (lookup);

WordPress Varnish Setup



1. Windows DNS Tweaks

  • Chrome DNS cleanup
  • Windows Pointing

    Windows Overriding to point to Different name-server/VPS to test

  • Clear Windows DNS Cache
    • ipconfig /flushdns

2. WordPress Varnish HTTPS Setup

Using Nginx as a proxy is the easiest and powerful method to use SSL on a Varnish scenario, all incoming SSL traffic on 443 port will be redirected by nginx to varnish on port 80. Workflow:

Nginx(SSL) -> Varnish(caching) -> Apache(back-end) -> WordPress(app)

Setup Configuration

HTTPS Request => NginX (443) => Varnish Server(80) => Apache Server(8080)
HTTP Request => Varnish Server(80) => Apache Server(8080)
Proxy Server)=> (Cache Server) => Backend WordPress CMS


sudo systemctl stop nginx
sudo systemctl restart nginx
netstat -ntlp | grep ng

sudo systemctl restart varnish
sudo systemctl stop varnish
netstat -ntlp | grep varn

sudo systemctl restart httpd.service
sudo systemctl stop httpd.service
netstat -ntlp | grep httpd


  1. Ngnix
    vi /etc/nginx/availablesites/wordzz.com.conf
    server {
            listen 443 ssl;

            server_name wordzz.com;
            ssl on;
            ssl_certificate /etc/letsencrypt/live/wordzz.com/fullchain.pem;
            ssl_certificate_key /etc/letsencrypt/live/wordzz.com/privkey.pem;

            location / {
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto https;
                proxy_set_header X-Forwarded-Port 443;
                proxy_set_header Host $host;

2. Varnish

Varnish change and 8080 (new listening port)
Earlier 80 to Listen 8080

vi /etc/varnish/default.vcl
(Also Replace Varnish Config with below for optimization)

Varnish Commands

varnishtop -i BereqURL

3. Apache

Step 1: Running Backend Server on 8080 port
vi /etc/sentora/configs/apache/port/port.conf
Listen 80 ->8080

Step 2: Change HTTP Domain port as-well to 8080
vi /etc/sentora/configs/apache/domains/wordzz.com.conf
# DOMAIN: wordzz.com

Step 3: Change HTTPS to different port(it doesn’t matter)
vi /etc/httpd/conf.d/ssl.conf
Listen 9443
ServerAlias www.wordzz.com

Step 4: Reference Main Config File
vi /etc/httpd/conf/httpd.conf

it should be working
curl -ik

Avoid HTTPS redirection

1. WP-Config
wp-config.php must have this line at the very top:

if ($_SERVER[‘HTTP_X_FORWARDED_PROTO’] === ‘https’){ $_SERVER[‘HTTPS’]=’on’; }

define(‘FORCE_SSL_ADMIN’, true);

2 .htacess changes

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Reference: Varnish Config Dump

    # This is an example VCL file for Varnish.
    # It does not do anything by default, delegating control to the
    # builtin VCL. The builtin VCL is called when there is no explicit
    # return statement.
    # See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/
    # and https://www.varnish-cache.org/trac/wiki/VCLExamples for more examples.

    # Marker to tell the VCL compiler that this VCL has been adapted to the
    # new 4.0 format.
    vcl 4.0;

    # Default backend definition. Set this to point to your content server.
    backend default {
        .host = "";
        .port = "80";
        .connect_timeout = 600s;
        .first_byte_timeout = 600s;
        .between_bytes_timeout = 600s;
        .max_connections = 800;

    # Only allow purging from specific IPs
    acl purge {

    # This function is used when a request is send by a HTTP client (Browser) 
    sub vcl_recv {
            # Normalize the header, remove the port (in case you're testing this on various TCP ports)
            set req.http.Host = regsub(req.http.Host, ":[0-9]+", "");

            # Allow purging from ACL
            if (req.method == "PURGE") {
                    # If not allowed then a error 405 is returned
                    if (!client.ip ~ purge) {
                            return(synth(405, "This IP is not allowed to send PURGE requests."));
                    # If allowed, do a cache_lookup -> vlc_hit() or vlc_miss()
                    return (purge);

            # Post requests will not be cached
            if (req.http.Authorization || req.method == "POST") {
                    return (pass);

            # --- WordPress specific configuration

            # Did not cache the RSS feed
            if (req.url ~ "/feed") {
                    return (pass);

            # Blitz hack
            if (req.url ~ "/mu-.*") {
                    return (pass);

            # Did not cache the admin and login pages
            if (req.url ~ "/wp-(login|admin)") {
                    return (pass);

            # Remove the "has_js" cookie
            set req.http.Cookie = regsuball(req.http.Cookie, "has_js=[^;]+(; )?", "");

            # Remove any Google Analytics based cookies
            set req.http.Cookie = regsuball(req.http.Cookie, "__utm.=[^;]+(; )?", "");

            # Remove the Quant Capital cookies (added by some plugin, all __qca)
            set req.http.Cookie = regsuball(req.http.Cookie, "__qc.=[^;]+(; )?", "");

            # Remove the wp-settings-1 cookie
            set req.http.Cookie = regsuball(req.http.Cookie, "wp-settings-1=[^;]+(; )?", "");

            # Remove the wp-settings-time-1 cookie
            set req.http.Cookie = regsuball(req.http.Cookie, "wp-settings-time-1=[^;]+(; )?", "");

            # Remove the wp test cookie
            set req.http.Cookie = regsuball(req.http.Cookie, "wordpress_test_cookie=[^;]+(; )?", "");

            # Are there cookies left with only spaces or that are empty?
            if (req.http.cookie ~ "^ *$") {
                        unset req.http.cookie;

            # Cache the following files extensions 
            if (req.url ~ ".(css|js|png|gif|jp(e)?g|swf|ico)") {
                    unset req.http.cookie;

            # Normalize Accept-Encoding header and compression
            # https://www.varnish-cache.org/docs/3.0/tutorial/vary.html
            if (req.http.Accept-Encoding) {
                    # Do no compress compressed files...
                    if (req.url ~ ".(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$") {
                                    unset req.http.Accept-Encoding;
                    } elsif (req.http.Accept-Encoding ~ "gzip") {
                            set req.http.Accept-Encoding = "gzip";
                    } elsif (req.http.Accept-Encoding ~ "deflate") {
                            set req.http.Accept-Encoding = "deflate";
                    } else {
                            unset req.http.Accept-Encoding;

            # Check the cookies for wordpress-specific items
            if (req.http.Cookie ~ "wordpress_" || req.http.Cookie ~ "comment_") {
                    return (pass);
            if (!req.http.cookie) {
                    unset req.http.cookie;

            # --- End of WordPress specific configuration

            # Do not cache HTTP authentication and HTTP Cookie
            if (req.http.Authorization || req.http.Cookie) {
                    # Not cacheable by default
                    return (pass);

            # Cache all others requests
            return (hash);

    sub vcl_pipe {
            return (pipe);

    sub vcl_pass {
            return (fetch);

    # The data on which the hashing will take place
    sub vcl_hash {
            if (req.http.host) {
            } else {

            # If the client supports compression, keep that in a different cache
            if (req.http.Accept-Encoding) {

            return (lookup);

    # This function is used when a request is sent by our backend (Nginx server)
    sub vcl_backend_response {
            # Remove some headers we never want to see
            unset beresp.http.Server;
            unset beresp.http.X-Powered-By;

            # For static content strip all backend cookies
            if (bereq.url ~ ".(css|js|png|gif|jp(e?)g)|swf|ico") {
                    unset beresp.http.cookie;

            # Only allow cookies to be set if we're in admin area
            if (beresp.http.Set-Cookie && bereq.url !~ "^/wp-(login|admin)") {
                    unset beresp.http.Set-Cookie;

            # don't cache response to posted requests or those with basic auth
            if ( bereq.method == "POST" || bereq.http.Authorization ) {
                    set beresp.uncacheable = true;
                    set beresp.ttl = 120s;
                    return (deliver);

            # don't cache search results
            if ( bereq.url ~ "?s=" ){
                    set beresp.uncacheable = true;
                    set beresp.ttl = 120s;
                    return (deliver);

            # only cache status ok
            if ( beresp.status != 200 ) {
                    set beresp.uncacheable = true;
                    set beresp.ttl = 120s;
                    return (deliver);

            # A TTL of 24h
            set beresp.ttl = 24h;
            # Define the default grace period to serve cached content
            set beresp.grace = 30s;

            return (deliver);

    # The routine when we deliver the HTTP request to the user
    # Last chance to modify headers that are sent to the client
    sub vcl_deliver {
            if (obj.hits > 0) {
                    set resp.http.X-Cache = "cached";
            } else {
                    set resp.http.x-Cache = "uncached";

            # Remove some headers: PHP version
            unset resp.http.X-Powered-By;

            # Remove some headers: Apache version & OS
            unset resp.http.Server;

            # Remove some heanders: Varnish
            unset resp.http.Via;
            unset resp.http.X-Varnish;

            return (deliver);

    sub vcl_init {
            return (ok);

    sub vcl_fini {
            return (ok);

Ramayana The Epic Hanuman

Beautiful Art Hanuman Carrying Ram

@Shaatish Rajendran

Ramayana The Epic Hanuman

Bahubali Hanuman

@Madhaw Bauri

Hanuman is a very popular Monkey-God. He can be seen in many Indian temples. He is the God of power and strength. He did not marry anybody in his life. He worshipped Lord Rama. He spent his entire life serving Lord Rama. Lord Rama loved him a lot. Tuesday is treated as the day of Hanuman Hundreds of Hindus worship him on this day.

Hanuman has a short thick neck, a round red face, sharp white teeth, beautiful hair and a long tail. He is very powerful. He can increase or decrease his size to either as big as a mountain or as small as a fly. A lot of stories about the brave Hanuman have been written in the Ramayana.

Hanuman The Indian god

Very beautiful painting of Hanuman The Indian god


Hanuman The Indian god by Shravan Kumar

Thrichittatt Maha Vishnu Temple, Chengannur, Kerala

The Mahavishnu Temple, Thrichittatt, Chengannoor is one of the five Vishnu temples associated with the five Pandava brothers, the principal characters of the Mahabharata. It is believed that Yudhisthira, one of the brothers, performed penance at this site. It is one of the “Divya Desams”, the 108 temples of Vishnu revered by the 12 poet saints, or Alwars.

About The Temple

The Lord faces east and the holy tank is known Shanku Teertam (or tank of the conch). Unlike other Vishnu temples, the Lord holds the conch in his right hand instead of discuss. There are also shrines for Sastha and Lord Krishna.


During Mahabharata war, Yudhisthira, the head of the Pandavas, who never before uttered a lie, lied in one instant to defeat his Guru, Dronacharya. To overcome the sin of the lie, he underwent penace worshipping the lord here. Imayavar(Devas) came to this place prior to Yudhisthira and hence the deity here is referred as Imayavarappar.

About the Deity

The main murti worshiped in the shrine is Vishnu in standing posture. It is made using Krishna Shila. The unique aspect of the murti is that it holds conch in right hand instead of the discus or chakra. Subsidiary deities worshiped in the temple are Ganesha, Sastha and Goshalakrishan. Goshalakrishan has a separate quite big shrine in the temple complex. He is offered special pujas. Special rituals are observed during festivals. The temple pond is known as Shankha Theertha. The temple has a large Nalambalam and Namaskara Mandapam. Wooden carvings are another noteworthy feature. The sanctum sanctorum is round and is made out of huge stones.

Legends and Stories

Lord Vishnu is worshiped here as Imayavarappan. It is believed that the murti worshiped in the temple was first offered prayers by Devas or celestial beings. Imayavar means Devas. As per 108 Divya Desham concepts, Vishnu worshiped here is known as Devathideva Perumal. There is no murti of Goddess Lakshmi in the temple. But the divya desham concept mentions the presence Goddess Lakshmi in the shrine as Raktapankaja Valli. In the Mahabharata war, Dronacharya was invincible. To kill him Yudhishtira uttered the lie that Ashwathama, his son died. After hearing the words from the mouth of Yudhishtira, Drona put his weapons down. Dhrishtadyumna used this opportunity and cut off the head of Dronacharya. Yudhishtira carried the remorse of lying for a long period. It is believed that he did penance at Thrichittatt Mahavishnu Temple for the sin. He installed the murti and offered prayers to it here.

Ganesha Altar at the Edge of Mt. Bromo Crater

Ganesha Altar at the Edge of Mt. Bromo Crater
Mount Bromo, East Java, Indonesia

Ram laxman & Hanuman with Vanar Sena

Ram laxman & Hanuman with Vanar Sena

The Universe – Spiti, Himachal Pradesh, India

by @biswaraj_das

The Universe – Spiti, Himachal Pradesh, India
This was shot at Langza, Spiti and probably the most popular place of spiti.Though there are many shots taken from this location here i tried to present this in my visual ways.

Spiti Valley is also known popularly as Little Tibet and is situated in the part of Himalayas located in Himachal Pradesh. It can be accessed only during the summer season and is basically a remote location. It is a nature lover’s delight given the fact that it is surrounded by glaciers and mountains. You can also see a number of villages nestled high atop mountain crests and several monasteries that have a lot of history in spite of their rather quaint appearance. The streams and rivers here are as clear as crystal. With the many monks dressed in robes and prayer flags swaying in the wind, you can be forgiven for thinking that you are somewhere in Tibet.

Origin of the name

The word Spiti means middle land, which indicates its location between India and China. It was originally known as Piti.

How to get to Spiti

The commonest way to get to Spiti is by cabs or buses that ply to this location from different towns in Himachal Pradesh and other parts of North India. You can first come by rail or bus to Shimla, which is 309 km from Spiti. The railway stations of Jogindher Nagar and Chandigarh are located pretty close by as well. The road that comes through Rohtang Pass is normally closed for 6 months owing to snowfall. You can also take the road via Manali since it is supposed to take the least time.

Endless River

Endless River by @andrilaukas

Pic of the day.fabulous


Hanuman Chalisa in Hindi

Shri Hanuman Chalisa Hindi Wallpaper

Shri Hanuman Chalisa Hindi Wallpaper We all know that the Shri Hanuman Chalisa is one of the Holy Chant that we can all use in...

Latest Articles

Sankat Mochan Hanuman Ashtak

The Sankat Mochan Hanuman Aashtak is an eight verse prayer in praise of the Hindu God of courage, strength, confidence and devotion...