• 5

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

SSL, Front-end caches, and web servers

I'm looking to add SSL to some sites. My current setup is varnish -> nginx -> python wsgi server. The varnish sits at the front and caches both static and dynamic content. The nginx server serves up the static media from disk and proxies other requests back to the python app. It works like a charm.

I've tried 2 different approaches to adding SSL and both have their drawbacks:

request on 443 > stunnel > varnish cache > nginx > python wsgi app

request on 443 > nginx/ssl > varnish cache > python wsgi app

The first approach has the benefit of continuing to cache static content. The main drawback is that I'm not sure how to redirect "non-https" traffic to the secure version, because once the traffic hits nginx it is unencrypted.

The second approach is also good, the only drawback is that varnish is no longer in front of the static content and therefore not caching it.

What do you guys think? Any ideas?

      • 2
    • Hmm, I'm pretty sure that Nginx has already a really good SSL engine. So I would recommend to remove Varnish for SSL requests (port 443) use Nginx directly. But you have for sure a good reason for this approach.

Regarding second approach, "the only drawback is that varnish is no longer in front of the content and therefor caching it". If nginx is serving it from local disk, the filesystem cache is already in effect so you are serving cached content.

There is no problem with the second approach, and is definitely the approach you should take.

  • 1
Reply Report

Trending Tags