Report ran and stated it was successful, even though site required basic auth. Check for www-authenticate header, if found return warning and abort.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

xurizaemon’s picture

Issue summary: View changes

On an htauth-protected URL using SSL, I see

Google PageSpeed Insights 0%
Report - Analysis by Google PageSpeed Insights service

Invalid value ''. Values must match the following regular expression: 'http(s)?://.*' (global - invalidParameter)

Full report at https://developers.google.com/speed/pagespeed/insights

Similarly using the server @ https://developers.google.com/speed/pagespeed/insights/ shows a 100% result but has a small warning at the top.

PageSpeed Insights received a 401 response from the server. To analyze pages behind firewalls or that require authentication, try the PageSpeed Insights browser extension.

xurizaemon’s picture

Title: Don't run Google PageSpeed Insights report if URL is locked » Don't run Google PageSpeed Insights report if URL is inaccessible
Status: Active » Needs review
FileSize
1.02 KB

OK, this checks that the responseCode was 200. This does the right thing for 401 etc, but probably wants feedback.

Currently the insights report seems to handle redirects out of the box (good).

Should we permit people to run insights on their 404 pages though? Maybe that should be a switch so it's still available, but by default shows an error if the URL is typoed?

FluxSauce’s picture

Version: 7.x-1.2 » 7.x-1.x-dev
Category: Feature request » Bug report

I'd say this is a bug, not a feature request. Sorry about the delay, I'll get this in there.

  • FluxSauce committed 9b2cea7 on 7.x-1.x authored by xurizaemon
    Issue #2064359 by FluxSauce, xurizaemon: Don't run Google PageSpeed...
FluxSauce’s picture

Status: Needs review » Closed (fixed)

Good catch, thank you! I did a little cleanup afterwards.

drush agi URL KEY
Google PageSpeed Insights: 0%
  Report
    URL is not accessible to PageSpeed Insights - response code 401) [error]
xurizaemon’s picture

Thanks. IDK if you want a patch for it, but ... OMG unbalanced brackets!

The line above the last change in http://cgit.drupalcode.org/site_audit/commit/?id=0e19ea68f58cbdc0a8cde37...

+ (
FluxSauce’s picture

Fixed, thanks again!