Static Assets from a Cookieless Domain

23 views
Skip to first unread message

Jason Leveille

unread,
May 24, 2014, 12:25:59 AM5/24/14
to ngx-pagesp...@googlegroups.com
Here's my setup:

Static Assets: static.myassets.com

Both of these domains exist on the same server.

pagespeed On;
pagespeed FileCachePath "/var/ngx_pagespeed_cache";
pagespeed
RewriteLevel CoreFilters;
pagespeed
MemcachedServers "ipaddy:11211";

server {  
    listen
443 ssl spdy;
    server_name www
.mysite.com;
   
...
    pagespeed
Domain https://static.myassets.com;
    pagespeed
MapOriginDomain "http://localhost" "https://www.mysite.com";
    pagespeed
LoadFromFile "https://static.myassets.com" "/path/to/staticfiles/";
    location
~ "^/pagespeed_static/" { }
    location
~ "^/ngx_pagespeed_beacon$" { }
    location
/ngx_pagespeed_statistics { allow 127.0.0.1; deny all; }
    location
/ngx_pagespeed_global_statistics { allow 127.0.0.1; deny all; }
    location
/ngx_pagespeed_message { allow 127.0.0.1; deny all; }
    location
/pagespeed_console { allow 127.0.0.1; deny all; }
    location
/pagespeed_admin { allow 127.0.0.1; deny all; }
    location
~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {add_header "" "";}
}

server {  
    listen
443 ssl spdy;
    server_name
static.myassets.com;
   
...
    location
~ "^/pagespeed_static/" { }
    location
~ "^/ngx_pagespeed_beacon$" { }
    location
/ngx_pagespeed_statistics { allow 127.0.0.1; deny all; }
    location
/ngx_pagespeed_global_statistics { allow 127.0.0.1; deny all; }
    location
/ngx_pagespeed_message { allow 127.0.0.1; deny all; }
    location
/pagespeed_console { allow 127.0.0.1; deny all; }
    location
/pagespeed_admin { allow 127.0.0.1; deny all; }
    location
~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {add_header "" "";}
}


When I run this, my static asset urls are being rewritten, however the server doesn't know where to find the assets.


Becomes (for example):


When I visit the rewritten url, I see a blank page.  I imagine it's because the server block for static.myassets.com doesn't know where to find this file.  What am I obviously missing here?  Is there something I'm neglecting to put in the static.myassets.com server block so it can handle this rewritten?  Seems like I'm making this way harder than it should be.

Any help would be appreciated.  Thanks all.

Jason Leveille

unread,
May 24, 2014, 10:16:01 AM5/24/14
to ngx-pagesp...@googlegroups.com
I've resolved the issue.  I moved away from static.myassets.com to static.mysite.com and things are now working as expected.  I removed all pagespeed related config from the static server block, and simply changed static.myassets.com to static.mysite.com, and now all is well with the world.
Reply all
Reply to author
Forward
0 new messages