Piwik plugin LoginHttpAuth blocks WP-Piwik
-
So things were working nicely until I decided to block unauthorised users to the Piwik login page by using the Piwik Marketplace plugin LoginHttpAuth.
The following is a modified version of the .htaccess code that Piwik recommends for this plugin.
#### Begin - Authentication ########## # # https://raw.githubusercontent.com/piwik/plugin-LoginHttpAuth/master/TemplateHtaccess/.htaccess # # This is a sample .htaccess file that will enable HTTP Authentication for your Piwik on apache server # To enable, move this file into the root of your Piwik folder, next to index.php and piwik.php # Restrict outside access # Replace the path below by the absolute path pointing to your htpasswd AuthUserFile /home/useracct/.htpasswds/public_html/piwik/passwd #AuthGroupFile /dev/null AuthName "piwik" AuthType Basic Order Allow,Deny # All files by default require authentication... <Files "*"> Require valid-user </Files> # modified authentication by ip address <Files "*"> Allow from piwik.mydomain.com mydomain.com xx.xxx.xxx.xx </Files> # ... except piwik.php and piwik.js which do not require authentication <Files ~ "^piwik\.(js|php)|robots\.txt$"> # <Files ~ "^piwik\.(js|php)|phpinfo\.php|robots\.txt$"> Allow from all Satisfy any # Including below line did not work for me # Require all granted </Files>I thought that by allowing the WP domain that WP-Piwik would be able to access the files it needed, but it is being blocked. Which files in Wp-Piwik do I need to whitelist?
Here is the output of the testscript
WP-Piwik 1.0.5 Mode: http Test 1/3: global.getPiwikVersion bool(false) array(2) { [0]=> string(603) "HTTP/1.1 401 Unauthorized Server: cloudflare-nginx Date: Tue, 03 Nov 2015 14:41:25 GMT Content-Type: text/html; charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive Set-Cookie: __cfduid=d1b6c4d209a282208b59.....561685; expires=Wed, 02-Nov-16 14:41:25 GMT; path=/; domain=.mydomain.com; HttpOnly Cache-Control: public, max-age=0 Expires: Tue, 03 Nov 2015 14:41:25 GMT Vary: Accept-Encoding,User-Agent WWW-Authenticate: Basic realm="piwik" X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1;mode=block X-Turbo-Charged-By: LiteSpeed CF-RAY: 23f8d7.....9be-ORD " [1]=> string(148) "https://piwik.mydomain.com/?module=API&method=API.getBulkRequest&format=json&urls[0]=method%3DAPI.getPiwikVersion%26idSite%3D1&token_auth=..." } Test 2/3: SitesManager.getSitesWithAtLeastViewAccess bool(false) array(2) { [0]=> string(603) "HTTP/1.1 401 Unauthorized Server: cloudflare-nginx Date: Tue, 03 Nov 2015 14:41:25 GMT Content-Type: text/html; charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive Set-Cookie: __cfduid=db1ac606a579f479febe9ab4a667e....1685; expires=Wed, 02-Nov-16 14:41:25 GMT; path=/; domain=.mydomain.com; HttpOnly Cache-Control: public, max-age=0 Expires: Tue, 03 Nov 2015 14:41:25 GMT Vary: Accept-Encoding,User-Agent WWW-Authenticate: Basic realm="piwik" X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1;mode=block X-Turbo-Charged-By: LiteSpeed CF-RAY: 23f8d705....5b5-ORD " [1]=> string(221) "https://piwik.mydomain.com/?module=API&method=API.getBulkRequest&format=json&urls[0]=method%3DAPI.getPiwikVersion%26idSite%3D1&urls[1]=method%3DSitesManager.getSitesWithAtLeastViewAccess%26idSite%3D1&token_auth=..." } Test 3/3: SitesManager.getSitesIdFromSiteUrl bool(false) array(2) { [0]=> string(603) "HTTP/1.1 401 Unauthorized Server: cloudflare-nginx Date: Tue, 03 Nov 2015 14:41:25 GMT Content-Type: text/html; charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive Set-Cookie: __cfduid=dde143a0f0e58a996a1a6dfb19a2481446561685; expires=Wed, 02-Nov-16 14:41:25 GMT; path=/; domain=.mydomain.com; HttpOnly Cache-Control: public, max-age=0 Expires: Tue, 03 Nov 2015 14:41:25 GMT Vary: Accept-Encoding,User-Agent WWW-Authenticate: Basic realm="piwik" X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1;mode=block X-Turbo-Charged-By: LiteSpeed CF-RAY: 23f8d706f24d-ORD " [1]=> string(324) "https://piwik.mydomain.com/?module=API&method=API.getBulkRequest&format=json&urls[0]=method%3DAPI.getPiwikVersion%26idSite%3D1&urls[1]=method%3DSitesManager.getSitesWithAtLeastViewAccess%26idSite%3D1&urls[2]=method%3DSitesManager.getSitesIdFromSiteUrl%26idSite%3D1%26url%3Dhttps%3A%2F%2Fmydomain.com&token_auth=..." } array(2) { ["global_settings"]=> array(57) { ["revision"]=> string(10) "2015101201" ["last_settings_update"]=> string(10) "1446025832" ["piwik_mode"]=> string(4) "http" ["piwik_url"]=> string(34) "https://piwik.mydomain.com/" ["piwik_path"]=> string(37) "/home/useracct/public_html/piwik/" ["piwik_user"]=> string(0) "" ["piwik_token"]=> string(3) "set" ["auto_site_config"]=> string(1) "0" ["default_date"]=> string(12) "current_week" ["stats_seo"]=> string(1) "0" ["dashboard_widget"]=> string(5) "today" ["dashboard_chart"]=> string(1) "1" ["dashboard_seo"]=> string(1) "0" ["toolbar"]=> string(1) "0" ["capability_read_stats"]=> array(5) { ["administrator"]=> string(1) "1" ["editor"]=> string(1) "0" ["author"]=> string(1) "0" ["contributor"]=> string(1) "0" ["subscriber"]=> string(1) "0" } ["perpost_stats"]=> string(1) "0" ["plugin_display_name"]=> string(8) "WP-Piwik" ["piwik_shortcut"]=> string(1) "0" ["shortcodes"]=> string(1) "0" ["track_mode"]=> string(2) "js" ["track_codeposition"]=> string(6) "footer" ["track_noscript"]=> string(1) "1" ["track_nojavascript"]=> string(1) "0" ["proxy_url"]=> string(28) "//piwik.mydomain.com/" ["track_content"]=> string(8) "disabled" ["track_search"]=> string(1) "0" ["track_404"]=> string(1) "0" ["add_post_annotations"]=> string(1) "0" ["add_customvars_box"]=> string(1) "0" ["add_download_extensions"]=> string(0) "" ["set_download_extensions"]=> string(0) "" ["disable_cookies"]=> string(1) "0" ["limit_cookies"]=> string(1) "0" ["limit_cookies_visitor"]=> string(8) "34186669" ["limit_cookies_session"]=> string(4) "1800" ["limit_cookies_referral"]=> string(8) "15778463" ["track_admin"]=> string(1) "0" ["capability_stealth"]=> array(4) { ["administrator"]=> string(1) "1" ["editor"]=> string(1) "1" ["author"]=> string(1) "1" ["contributor"]=> string(1) "1" } ["track_across"]=> string(1) "0" ["track_across_alias"]=> string(1) "0" ["track_feed"]=> string(1) "0" ["track_feed_addcampaign"]=> string(1) "0" ["track_feed_campaign"]=> string(4) "feed" ["track_heartbeat"]=> string(2) "30" ["cache"]=> string(1) "1" ["http_connection"]=> string(4) "curl" ["http_method"]=> string(4) "post" ["disable_timelimit"]=> string(1) "0" ["connection_timeout"]=> string(1) "5" ["disable_ssl_verify"]=> string(1) "0" ["piwik_useragent"]=> string(3) "php" ["piwik_useragent_string"]=> string(8) "WP-Piwik" ["track_datacfasync"]=> string(1) "1" ["track_cdnurl"]=> string(0) "" ["track_cdnurlssl"]=> string(0) "" ["force_protocol"]=> string(5) "https" ["update_notice"]=> string(7) "enabled" } ["settings"]=> array(6) { ["name"]=> string(0) "" ["site_id"]=> string(1) "1" ["noscript_code"]=> string(120) "<noscript><p><img src="//www.piwik.mydomain.com/js/index.php?idsite=1" style="border:0;" alt="" /></p></noscript>" ["tracking_code"]=> string(0) "" ["last_tracking_code_update"]=> string(1) "0" ["dashboard_revision"]=> string(1) "0" } }Thanks.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
The topic ‘Piwik plugin LoginHttpAuth blocks WP-Piwik’ is closed to new replies.