Problems Proxying Offline Web Application

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 :slight_smile:

Thanks,

Curtis

Posted at Nginx Forum:

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:

On 1 June 2011 17:38, cschiewek [email protected] 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”?

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.