SSI working on Apache backend, but not on gunicorn backend

j0nes2k nginx-forum at
Thu Oct 31 14:33:33 UTC 2013


I have nginx in front of an Apache server and a gunicorn server for
different parts of my website. I am using the SSI module in nginx to display
a snippet in every page. The websites include a snippet in this form:
<!--# include virtual="/mysnippet.txt" -->

For static pages served by nginx everything is working fine, the same goes
for the Apache-generated pages - the SSI include is evaluated and the
snippet is filled. However for requests to my gunicorn backend running a
Python app in Django, the SSI include does not get evaluated.

Here is the relevant part of the nginx config:

    location /cgi-bin/ {
         ssi on;
         proxy_pass         http://default_backend/cgi-bin/;
         include  sites-available/aspects/proxy-default.conf;

    location /directory/ {
         ssi on;
         limit_req zone=directory nodelay burst=3;
         proxy_pass         http://django_backend/directory/;
         include  sites-available/aspects/proxy-default.conf;

upstream django_backend {
    server max_fails=5  fail_timeout=10s;
upstream default_backend {


proxy_redirect     off;
proxy_set_header   Host             $host;
proxy_set_header   X-Real-IP        $remote_addr;
proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

What is the cause for this behaviour? How can I get SSI includes working for
my pages generated on gunicorn? How can I debug this further?

Thank you for your help!

Best regards,


Posted at Nginx Forum:,244299,244299#msg-244299

More information about the nginx mailing list