# Problems Proxying Offline Web Application

**URL:** <https://www.ruby-forum.com/t/problems-proxying-offline-web-application/207739>\
**Category:** NGINX\
**Created:** [June 1, 2011, 5:38pm UTC](https://www.ruby-forum.com/t/problems-proxying-offline-web-application/207739 "2011-06-01T17:38:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [June 1, 2011, 5:38pm UTC](https://www.ruby-forum.com/t/problems-proxying-offline-web-application/207739/1 "2011-06-01T17:38:43Z")

</div>

Hi All,

We’re in the process of prototyping some HTML5 offline apps. They work  
offline when running directly from the app server (webrick or unicorn in  
this case), but they won’t work in offline mode when proxying via nginx.  
We’re running 0.8.53. Here’s our config:

user nginx;  
worker\_processes 1;

events {  
worker\_connections 1024;  
}

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

```
sendfile on;
keepalive_timeout 65;

ssl_certificate /etc/ssl/cert.crt;
ssl_certificate_key /etc/ssl/key.pem;

upstream application {
     server unix:/var/sockets/application.sock fail_timeout=0;
}

server {
    listen 80;

    client_max_body_size 4G;
    server_name server.fqdn.com;
    keepalive_timeout 5;
    root /srv/www/application;
    index index.html;

    location / {
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto https;
      proxy_set_header Host $http_host;
      proxy_redirect off;
      proxy_pass http://applicaiton;
      if ($query_string ~ "^[0-9]+$") {
        add_header Cache-Control public;
      }
    }
}

```

}

Any help/guidance is much appreciated 🙂

Thanks,

Curtis

Posted at Nginx Forum:

> **[Problems Proxying Offline Web Application](https://forum.nginx.org/read.php?2,203030,203030#msg-203030)**
>
> Hi All, We're in the process of prototyping some HTML5 offline apps. They work offline when running directly from the app server (webrick or unicorn in this case), but they won't work in offline mode when proxying via nginx. We're running 0.8.53....

---

<div class="post-metadata">

**Author:** ![cschiewek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ac8455/32.png) [@cschiewek](https://www.ruby-forum.com/u/cschiewek)\
**Post date:** [June 1, 2011, 7:18pm UTC](https://www.ruby-forum.com/t/problems-proxying-offline-web-application/207739/2 "2011-06-01T19:18:54Z")

</div>

I load the app in FF4 and it works fine. I switch to “offline mode” in  
FF and restart the browser and and the app no longer works. If I repeat  
the process without using nginx as a proxy, it works fine.

Posted at Nginx Forum:

> **[Re: Problems Proxying Offline Web Application](https://forum.nginx.org/read.php?2,203030,203051#msg-203051)**
>
> Hi All, We're in the process of prototyping some HTML5 offline apps. They work offline when running directly from the app server (webrick or unicorn in this case), but they won't work in offline mode when proxying via nginx. We're running 0.8.53....

---

<div class="post-metadata">

**Author:** ![cschiewek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ac8455/32.png) [@cschiewek](https://www.ruby-forum.com/u/cschiewek)\
**Post date:** [June 1, 2011, 6:46pm UTC](https://www.ruby-forum.com/t/problems-proxying-offline-web-application/207739/3 "2011-06-01T18:46:08Z")

</div>

On 1 June 2011 17:38, cschiewek [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi All,
> 
> We’re in the process of prototyping some HTML5 offline apps. They work  
> offline when running directly from the app server (webrick or unicorn in  
> this case), but they won’t work in offline mode when proxying via nginx.  
> We’re running 0.8.53.

What do you mean by “they won’t work in offline mode”?

---

<div class="post-metadata">

**Author:** ![cschiewek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ac8455/32.png) [@cschiewek](https://www.ruby-forum.com/u/cschiewek)\
**Post date:** [June 2, 2011, 2:44pm UTC](https://www.ruby-forum.com/t/problems-proxying-offline-web-application/207739/4 "2011-06-02T14:44:02Z")

</div>

Hello,

Wild guess: your directive  
add\_header Cache-Control public;  
affects somehow the overall caching mechanism. Now, you probably have  
a good reason to have this here…

Firebug might come handy here, too.

A.
