# Problem with nginx in combination with ujs plugin and firefo

**URL:** <https://www.ruby-forum.com/t/problem-with-nginx-in-combination-with-ujs-plugin-and-firefo/107701>\
**Category:** Rails\
**Created:** [June 25, 2007, 3:03pm UTC](https://www.ruby-forum.com/t/problem-with-nginx-in-combination-with-ujs-plugin-and-firefo/107701 "2007-06-25T15:03:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 25, 2007, 3:03pm UTC](https://www.ruby-forum.com/t/problem-with-nginx-in-combination-with-ujs-plugin-and-firefo/107701/1 "2007-06-25T15:03:59Z")

</div>

Hi,  
I have a nginx frontend server with a mongrel backend.  
it all worked fine.

Then i used the ujs plugin and changed the following line in the  
nginx.conf

i changed this section:

```
        location ~*

```

^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov)$  
{  
client\_max\_body\_size 20M;  
root /var/rails\_apps/hozl/public;  
}

i removed the ‘js’ extension because otherwise nginx tries to serve all  
the javascript which now is partly generated by mongrel because of the  
ujs plugin

after this change all worked fine … on IE  
the problems begin with firefox.  
(mostly it is the other way around, i know :))

sometimes i can load a page quickly but very often all seems to freeze.  
firefox says "waiting for " and after a while i get a page  
looking like html source code like this:

HTTP/1.1 302 Moved TemporarilyServer: nginx/0.5.11  
Date: Mon, 25 Jun 2007 12:43:28 GMT  
Content-Type: text/html  
Connection: keep-alive  
Set-Cookie: \_session\_id=1f42a7cd18af6b0bf56afb3f9de57adf; path=/  
Status: 302 Found  
Cache-Control: no-cache  
location: [http://demo5.xwire.nl/patients/search](http://demo5.xwire.nl/patients/search)  
Content-Length: 103

You are being [redirected](http://demo5.xwire.nl/patients/search).

my nginx.conf file looks like this:

# number of nginx workers

worker\_processes 6;

error\_log logs/error.log notice;  
pid logs/nginx.pid;

# Number of worker connections. 1024 is a good default

events {  
worker\_connections 1024;  
}

http {  
include conf/mime.types;  
default\_type application/octet-stream;

```
# no sendfile on OSX uncomment
# this if your on linux or bsd
sendfile on;
tcp_nopush on;
tcp_nodelay off;

#keepalive_timeout 165;

```

upstream hozl2 {  
server 127.0.0.1:8030;  
server 127.0.0.1:8031;  
server 127.0.0.1:8032;

```
}

```

server {  
listen 80;  
client\_max\_body\_size 50M;  
server\_name hozl2;  
root /var/rails\_apps/hozl2/public;

```
    access_log off;
    rewrite_log on;

        # / -> first search for local index.html then go to mongrel
        location ~ ^/$ {
client_max_body_size 20M;
            if (-f /index.html){
                rewrite (.*) /index.html last;
            }
            proxy_pass http://hozl2;
        }

        # rail caching: searching first for $action.html local pages
        location / {
client_max_body_size 20M;
            if (!-f $request_filename.html) {
                proxy_pass http://hozl2;
            }
            rewrite (.*) $1.html last;
        }

        # serve static files directly
        location ~ .html {
client_max_body_size 50M;
            root /var/rails_apps/hozl2/public;
        }

        location ~*

```

^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|mov)$  
{  
client\_max\_body\_size 50M;  
root /var/rails\_apps/hozl2/public;  
}

```
        # resend everything else to mongrel
        location / {
client_max_body_size 50M;
            proxy_pass http://hozl2;
            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;  
}

```
}

```

}

i hope somebody knows where to look, cause i am lost here

thanks

Remco
