.htaccess for cdn & staging died

Ok so I’m attempting to use two .htaccess files in order to load content on: http://staging.rjs-creative.com and one on http://cdn.rjs-creative.com in order to display fonts on staging.rjs-creative.com/test.php from cdn.rjs-creative.com/fonts/ – but it doesn’t seem to be working and I’m going crazy here!

My ACCESS Log via cdn subdomain shows:

[14/May/2015:11:10:53 -0400] “GET /fonts/Hoverage-Vintage.otf
HTTP/1.0” 200 582 “cdn.rjs-creative.com/css/stylesheet.min.css”
“Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/42.0.2311.135 Safari/537.36”

The ERROR Log via staging subdomain shows:

[Thu May 14 10:26:20 2015] [error] [client 5.189.144.88] Directory
index forbidden by Options directive:
/var/www/vhosts/rjs-creative.com/httpdocs/

My CDN HTACCESS is as follows..

Header unset ETag FileETag None Header set
Cache-Control “public” Header set Expires “Thu, 15 Apr 2018 20:00:00
GMT” Header set Last-Modified “Thu, 7 Nov 2013 12:00:00 GMT”
Header set
Cache-Control “max-age=7200, must-revalidate”
SetOutputFilter DEFLATE Header set Expires
“Thu, 15 Apr 2018 20:00:00 GMT” AddDefaultCharset utf-8
Header append Vary: Accept-Encoding AddOutputFilterByType DEFLATE
text/plain AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE
text/css AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl|webm)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.gzip.
ExpiresActive On
ExpiresDefault “access plus 1 year” Header set Access-Control-Allow-Origin “*”

Now my STAGING HTACCESS is as follows…

Header set
Access-Control-Allow-Origin “*” Header unset ETag
FileETag None Header set
Cache-Control “public” Header set Expires “Thu, 15 Apr 2018 20:00:00
GMT” Header set Last-Modified “Thu, 7 Nov 2013 12:00:00 GMT”
Header set
Cache-Control “max-age=7200, must-revalidate”
SetOutputFilter DEFLATE Header set Expires
“Thu, 15 Apr 2018 20:00:00 GMT” AddDefaultCharset utf-8
Header append Vary: Accept-Encoding

AddType application/vnd.ms-fontobject eot
AddType application/x-font-ttf .ttf
AddType font/opentype otf
AddType application/x-font-woff woff
AddType image/svg+xml svg svgz
AddEncoding gzip svgz

AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype

AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE
text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType
DEFLATE text/css AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.gzip.
ExpiresActive On
ExpiresDefault “access plus 1 year”
Header set Connection keep-alive Header add Access-Control-Allow-Origin “*” Header add
Access-Control-Allow-Headers “origin, x-requested-with, content-type”
Header add Access-Control-Allow-Methods “PUT, GET, POST, DELETE,
OPTIONS”

I am in no way brilliant when it comes to using .htaccess files, but the company that I work for’s head developer guided me to use this same .htaccess layout and it seems to work fine when we develop websites there.

I have set my .htaccess to do a 301 redirect which works, to show that the htaccess is definitely initializing. Eugh.

You know those times when you’ve been trying to fix something for so long and you’ve been staring it for so long you start thinking in code… my life right now. Any help would be amazingly appreciated!

  • EDIT *

My Element Inspection comes up with this error:

Font from origin ‘cdn.rjs-creative.com’ has been blocked from
loading by Cross-Origin Resource Sharing policy: No
‘Access-Control-Allow-Origin’ header is present on the requested
resource. Origin ‘staging.rjs-creative.com’ is therefore not
allowed access.

But am I going crazy, there’s Header set in BOTH files to enable cross-domain access!?


Source: apache

Leave a Reply