WP:Connect Matomo, NGINX 302

:uk:/:us: Message template (english)

My YunoHost server

Hardware: VPS bought online at netcup VPS 200 G10s
YunoHost version: 11.2.9.1 (stable)
I have access to my server : Through SSH
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

Description of my issue

I just installed Yunohost and directly installed Matomo. Now I installed the wordpress plugin Matomo-Connect to use it for my website hosted somewhere else. But I can’t seem to connect it. It just says, it can’t connect. If I run the test script in the wp-plugin I first got the error:

HTTP/1.1 301 Moved Permanently Server:

Now I get this, when calling the testscript:

`WP-Matomo 1.0.30
Mode: http

Test 1/3: global.getPiwikVersion

bool(false)

array(2) {
  [0]=>
  string(639) "HTTP/2 302 
server: nginx
date: Wed, 03 Jan 2024 17:26:41 GMT
content-type: text/html
location: https://mydomain/yunohost/sso/?r=aHR0cHM6Ly9hbmFseXRpY3MuYXJ0aWNsZXR0LnNjaHVsZS9tYXRvbW8v
x-sso-wat: You've just been SSOed
content-security-policy: upgrade-insecure-requests
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
x-download-options: noopen
x-permitted-cross-domain-policies: none
x-frame-options: SAMEORIGIN
permissions-policy: interest-cohort=()
strict-transport-security: max-age=63072000; includeSubDomains; preload
referrer-policy: origin always
access-control-allow-origin: *

"
  [1]=>
  string(155) "https://mydomain/matomo/?module=API&method=API.getBulkRequest&format=json&urls[0]=method%3DAPI.getPiwikVersion%26idSite%3D&token_auth=..."
}

Test 2/3: SitesManager.getSitesWithAtLeastViewAccess

bool(false)

array(2) {
  [0]=>
  string(639) "HTTP/2 302 
server: nginx
date: Wed, 03 Jan 2024 17:26:41 GMT
content-type: text/html
location: https://mydomain/yunohost/sso/?r=aHR0cHM6Ly9hbmFseXRpY3MuYXJ0aWNsZXR0LnNjaHVsZS9tYXRvbW8v
x-sso-wat: You've just been SSOed
content-security-policy: upgrade-insecure-requests
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
x-download-options: noopen
x-permitted-cross-domain-policies: none
x-frame-options: SAMEORIGIN
permissions-policy: interest-cohort=()
strict-transport-security: max-age=63072000; includeSubDomains; preload
referrer-policy: origin always
access-control-allow-origin: *

"
  [1]=>
  string(227) "https://mydomain/matomo/?module=API&method=API.getBulkRequest&format=json&urls[0]=method%3DAPI.getPiwikVersion%26idSite%3D&urls[1]=method%3DSitesManager.getSitesWithAtLeastViewAccess%26idSite%3D&token_auth=..."
}

Test 3/3: SitesManager.getSitesIdFromSiteUrl

bool(false)

array(2) {
  [0]=>
  string(639) "HTTP/2 302 
server: nginx
date: Wed, 03 Jan 2024 17:26:41 GMT
content-type: text/html
location: https://mydomain/yunohost/sso/?r=aHR0cHM6Ly9hbmFseXRpY3MuYXJ0aWNsZXR0LnNjaHVsZS9tYXRvbW8v
x-sso-wat: You've just been SSOed
content-security-policy: upgrade-insecure-requests
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
x-download-options: noopen
x-permitted-cross-domain-policies: none
x-frame-options: SAMEORIGIN
permissions-policy: interest-cohort=()
strict-transport-security: max-age=63072000; includeSubDomains; preload
referrer-policy: origin always
access-control-allow-origin: *

"
  [1]=>
  string(330) "https://mydomain/matomo/?module=API&method=API.getBulkRequest&format=json&urls[0]=method%3DAPI.getPiwikVersion%26idSite%3D&urls[1]=method%3DSitesManager.getSitesWithAtLeastViewAccess%26idSite%3D&urls[2]=method%3DSitesManager.getSitesIdFromSiteUrl%26idSite%3D%26url%3Dhttps%3A%2F%2Farticlett.schule&token_auth=..."
}



array(2) {
  ["global_settings"]=>
  array(69) {
    ["revision"]=>
    string(10) "2023092201"
    ["last_settings_update"]=>
    string(10) "1704302793"
    ["piwik_mode"]=>
    string(4) "http"
    ["piwik_url"]=>
    string(42) "https://mydomain/matomo/"
    ["piwik_path"]=>
    string(0) ""
    ["piwik_user"]=>
    string(0) ""
    ["matomo_user"]=>
    string(0) ""
    ["piwik_token"]=>
    string(3) "set"
    ["auto_site_config"]=>
    string(1) "1"
    ["default_date"]=>
    string(9) "yesterday"
    ["stats_seo"]=>
    string(1) "0"
    ["stats_ecommerce"]=>
    string(1) "0"
    ["dashboard_widget"]=>
    string(8) "disabled"
    ["dashboard_ecommerce"]=>
    string(1) "0"
    ["dashboard_chart"]=>
    string(1) "0"
    ["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(8) "disabled"
    ["plugin_display_name"]=>
    string(14) "Connect Matomo"
    ["piwik_shortcut"]=>
    string(1) "0"
    ["shortcodes"]=>
    string(1) "0"
    ["track_mode"]=>
    string(7) "default"
    ["track_codeposition"]=>
    string(6) "footer"
    ["track_noscript"]=>
    string(1) "0"
    ["track_nojavascript"]=>
    string(1) "0"
    ["proxy_url"]=>
    string(0) ""
    ["track_content"]=>
    string(8) "disabled"
    ["track_search"]=>
    string(1) "0"
    ["track_404"]=>
    string(1) "0"
    ["add_post_annotations"]=>
    array(0) {
    }
    ["add_customvars_box"]=>
    string(1) "0"
    ["add_download_extensions"]=>
    string(0) ""
    ["set_download_extensions"]=>
    string(0) ""
    ["set_link_classes"]=>
    string(0) ""
    ["set_download_classes"]=>
    string(0) ""
    ["require_consent"]=>
    string(8) "disabled"
    ["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(0) {
    }
    ["track_across"]=>
    string(1) "0"
    ["track_across_alias"]=>
    string(1) "0"
    ["track_crossdomain_linking"]=>
    string(1) "0"
    ["track_feed"]=>
    string(1) "0"
    ["track_feed_addcampaign"]=>
    string(1) "0"
    ["track_feed_campaign"]=>
    string(4) "feed"
    ["track_heartbeat"]=>
    string(1) "0"
    ["track_user_id"]=>
    string(8) "disabled"
    ["cache"]=>
    string(1) "1"
    ["http_connection"]=>
    string(4) "curl"
    ["http_method"]=>
    string(4) "post"
    ["disable_timelimit"]=>
    string(1) "0"
    ["filter_limit"]=>
    string(0) ""
    ["connection_timeout"]=>
    string(1) "5"
    ["disable_ssl_verify"]=>
    string(1) "0"
    ["disable_ssl_verify_host"]=>
    string(1) "0"
    ["piwik_useragent"]=>
    string(3) "php"
    ["piwik_useragent_string"]=>
    string(8) "WP-Piwik"
    ["dnsprefetch"]=>
    string(1) "0"
    ["track_datacfasync"]=>
    string(1) "0"
    ["track_cdnurl"]=>
    string(0) ""
    ["track_cdnurlssl"]=>
    string(0) ""
    ["force_protocol"]=>
    string(8) "disabled"
    ["remove_type_attribute"]=>
    string(1) "0"
    ["update_notice"]=>
    string(7) "enabled"
  }
  ["settings"]=>
  array(6) {
    ["name"]=>
    string(0) ""
    ["site_id"]=>
    string(0) ""
    ["noscript_code"]=>
    string(0) ""
    ["tracking_code"]=>
    string(0) ""
    ["last_tracking_code_update"]=>
    string(1) "0"
    ["dashboard_revision"]=>
    string(1) "0"
  }
}
`
...

I guess NGINX is doing someting wrong? Do I need to configure nginx so it works with matomo?

It would help if you can provide the full message, including the “Location:” thing where the 302 redirects to

I edited my post. Thank you.

And can you confirm that the target url is enabled for “visitors” in the yunohost permissions (in Users > Groups and permissions) ? It’s not clear to me if it’s about wordpress or matomo

oh wow, that was the fix! It never said that in the instruction on yunohost/matomo to enable this. And I had no knowledge about this setting yet. Thanks a lot!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.