Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm playing around with node.js, right now. I like it a lot. I have a weird error. If I start the test server with

node app.js

and navigate to http://localhost:3000, everything is fine. The stylesheet is loaded and everythings looks as it should. But if I navigate to the site via nginx, the site and the stylesheet is loaded, but it seems to be ignored. It's the same source-code. It parsed the same way. And I already tested, that the stylesheet is loaded properly. I really don't have an idea anymore. Anyone else?

Here is my nginx vhost-config:

server {
    listen 80;
    server_name expressapp.lc;

    root /home/matthias/Documents/webapps/expressapp/public;

    location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
        expires         15d;
    }

    location / {
        proxy_pass              http://127.0.0.1:3000;
        proxy_set_header        X-Real-IP       $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        Host            $http_host;
        proxy_set_header        X-NginX-Proxy   true;
        proxy_redirect off;
    }

    gzip on;
    gzip_comp_level 2;
    gzip_proxied any;
    gzip_min_length  1000;
    gzip_disable     "MSIE [1-6]\."
    gzip_types text/plain text/css application/json application/x-javascript text/xml   application/xml application/xml+rss text/javascript;
}

Thanks for your help.

share|improve this question

migrated from stackoverflow.com Jun 17 '11 at 18:08

This question came from our site for professional and enthusiast programmers.

    
Have you tried disabling GZIP encoding? –  sam Jun 17 '11 at 21:30

1 Answer 1

To make things clear, you should:

  1. remove the location section that allowing client cache.
  2. turn off the gzip compression, e.g. comment out all the gzip staff
  3. change the "proxy_set_header Host $http_host" to "proxy_set_header Host $host"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.