pagespeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] mashirozx commented on issue #1005: PageSpeed Optimized CSS and CORS Headers
Date Fri, 23 Mar 2018 16:00:24 GMT
mashirozx commented on issue #1005: PageSpeed Optimized CSS and CORS Headers
URL: https://github.com/apache/incubator-pagespeed-ngx/issues/1005#issuecomment-375713921
 
 
   I meeet something like this:
   
   >Failed to load https://a.com/tips_v3.7.json: The 'Access-Control-Allow-Origin' header
contains multiple values '*, *', but only one is allowed. Origin 'https://a.com' is therefore
not allowed access.
   
   And this is my Nginx configuration:
   
   ```
           .......
           pagespeed on;
   	# Default
   	# Needs to exist and be writable by nginx.  Use tmpfs for best performance.
   	pagespeed FileCachePath /var/ngx_pagespeed_cache;
   
   	# Ensure requests for pagespeed optimized resources go to the pagespeed handler
   	# and no extraneous headers get set.
   	location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
   	  add_header "" "";
   	}
   	location ~ "^/pagespeed_static/" { }
   	location ~ "^/ngx_pagespeed_beacon$" { }
   
   	location ~* \.(json)$ {
   	    if ($http_referer = "") {   return 403;  }
               add_header 'Access-Control-Allow-Origin' *;
               add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
               add_header 'Access-Control-Allow-Credentials' 'true';
               add_header 'Access-Control-Allow-Headers' 'User-Agent,Keep-Alive,Content-Type';
   	    
               expires 7d;
   	    log_not_found off;
   	}
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message