Closed Bug 884395 Opened 13 years ago Closed 13 years ago

[sumo] Apache .htaccess not working for static/

Categories

(Infrastructure & Operations Graveyard :: WebOps: Other, task)

All
Other
task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: rrosario, Assigned: cturra)

References

Details

We recently moved all our static css/js/img/fonts/etc from media/ to static/. Along with that, we moved copied over our .htaccess files to static/. https://github.com/mozilla/kitsune/blob/master/static/.htaccess https://github.com/mozilla/kitsune/blob/master/static/fonts/.htaccess From what I can tell, these aren't getting pulled in or there is some issue with them. For example, fonts are being served as text/plain: https://support.allizom.org/static/fonts/MetaWebPro-Bold.woff https://support.mozilla.org/static/fonts/MetaWebPro-Bold.woff Response Headers: X-Cache-Info: cached X-Backend-Server: support1.stage.webapp.phx1.mozilla.com Vary: Accept-Encoding Transfer-Encoding: chunked Server: Apache Last-Modified: Thu, 06 Jun 2013 17:18:28 GMT Keep-Alive: timeout=5, max=998 Etag: "5a08" Date: Tue, 18 Jun 2013 16:32:17 GMT Content-Type: text/plain; charset=UTF-8 Content-Encoding: gzip Connection: Keep-Alive Halp?
the .htaccess files look to be present. do their contents look incorrect? [root@support1.stage.webapp.phx1 support.allizom.org]# find kitsune/static -name .htaccess kitsune/static/fonts/.htaccess kitsune/static/.htaccess [root@support1.stage.webapp.phx1 support.allizom.org]# find kitsune/static -name .htaccess -exec cat {} \; # CORS only for mozilla domains SetEnvIf Origin "https?://(.*\.mozilla\.(com|org|net))" CORS=$0 Header set Access-Control-Allow-Origin %{CORS}e env=CORS # block hotlinking by referer to .woff, .eof, .ttf files except mozilla domains RewriteCond "%{HTTP_REFERER}" "!https?://.*\.mozilla\.(com|org|net)/.*$" RewriteRule \.(woff|eot|ttf)$ - [F,NC,L,E=!CORS] <FilesMatch "\.(ttf|woff|eot)$"> Header append vary "Origin" ExpiresActive On ExpiresDefault "access plus 1 year" </FilesMatch> # Neither Firefox nor Safari will draw these if they're text/xml AddType image/svg+xml .svg AddType application/octet-stream .exe AddType application/font-woff .woff AddType application/vnd.ms-fontobject .eot AddType application/octet-stream .ttf AddCharset utf-8 .css .js # Set far-future Expires headers for static media ExpiresActive on ExpiresDefault "access plus 1 week" ExpiresByType text/css "access plus 1 year" ExpiresByType text/javascript "access plus 1 year" ExpiresByType image/png "access plus 1 month" ExpiresByType image/jpeg "access plus 1 month" ExpiresByType image/gif "access plus 1 month" ExpiresByType image/svg+xml "access plus 1 month" ExpiresByType image/vnd.microsoft.icon "access plus 1 month" ExpiresByType video/webm "access plus 1 week" ExpiresByType video/ogg "access plus 1 week" ExpiresByType video/x-flv "access plus 1 week" ExpiresByType application/x-shockwave-flash "access plus 1 week" ExpiresByType text/plain "access plus 0 seconds" ExpiresByType application/octet-stream "access plus 0 seconds" FileETag MTime <FilesMatch "\.txt$"> FileETag None </FilesMatch>
:cturra, that looks right. Why isn't it being respected by apache then?
i am not certain, but i did test with the following in the apache config with success: <Directory "/data/www/support.allizom.org/kitsune/static/fonts"> AllowOverride All AddType application/font-woff .woff AddHandler font-woff .woff </Directory> do you want me to move these mime directives to the apache config?
(In reply to Chris Turra [:cturra] from comment #3) > i am not certain, but i did test with the following in the apache config > with success: > > <Directory "/data/www/support.allizom.org/kitsune/static/fonts"> > AllowOverride All > AddType application/font-woff .woff > AddHandler font-woff .woff > </Directory> > > > do you want me to move these mime directives to the apache config? sure! I assume that's what we had before for media?
looks like i have this sorted out now (keeping the AddType definitions in the .htaccess file). what we needed to do was add the following directives to the apache config: + + <Directory "/data/www/support.allizom.org/kitsune/static"> + AllowOverride All + </Directory> + + <Directory "/data/www/support.allizom.org/kitsune/static/fonts"> + AllowOverride All + </Directory> i have committed this to puppet and it should be available for testing in 30 minutes. i will report back once i have had a moment to properly test this.
looks good to me :) $ curl -I https://support.allizom.org/static/fonts/MetaWebPro-Bold.woff HTTP/1.1 200 OK Server: Apache X-Backend-Server: support1.stage.webapp.phx1.mozilla.com vary: Origin Cache-Control: max-age=31536000 Content-Type: application/font-woff Date: Tue, 18 Jun 2013 23:32:19 GMT Expires: Wed, 18 Jun 2014 23:32:19 GMT Accept-Ranges: bytes ETag: "4de7f80aee100" Last-Modified: Thu, 06 Jun 2013 17:18:28 GMT X-Cache-Info: caching Content-Length: 23048
Assignee: server-ops-webops → cturra
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Woot! Thank you!
Status: RESOLVED → VERIFIED
I forgot to check prod: (kitsune)[rlr (master) kitsune]$ curl -I https://support.mozilla.org/static/fonts/MetaWebPro-Bold.woff HTTP/1.1 200 OK Server: Apache X-Backend-Server: support3.webapp.phx1.mozilla.com Vary: Accept-Encoding Content-Type: text/plain; charset=UTF-8 Date: Wed, 19 Jun 2013 13:48:35 GMT Accept-Ranges: bytes ETag: "5a08" Last-Modified: Thu, 06 Jun 2013 18:29:03 GMT X-Cache-Info: caching Content-Length: 23048
Status: VERIFIED → REOPENED
Resolution: FIXED → ---
Blocks: 884088
prod also updated. $ curl -I https://support.mozilla.org/static/fonts/MetaWebPro-Bold.woff HTTP/1.1 200 OK Server: Apache X-Backend-Server: support1.webapp.phx1.mozilla.com vary: Origin Cache-Control: max-age=31536000 Content-Type: application/font-woff Date: Wed, 19 Jun 2013 16:49:30 GMT Expires: Thu, 19 Jun 2014 16:49:30 GMT Accept-Ranges: bytes ETag: "4de807d1bd9c0" Last-Modified: Thu, 06 Jun 2013 18:29:03 GMT X-Cache-Info: caching Content-Length: 23048
Status: REOPENED → RESOLVED
Closed: 13 years ago13 years ago
Resolution: --- → FIXED
Component: Server Operations: Web Operations → WebOps: Other
Product: mozilla.org → Infrastructure & Operations
Product: Infrastructure & Operations → Infrastructure & Operations Graveyard
You need to log in before you can comment on or make changes to this bug.