@artif-AndreasBrus opened this Issue on March 30th 2022

Expected Behavior

From Dashboard /Visitor show Visitor Log
Overview is showing up and all other reports are showing data

Current Behavior

Red Ooops Message and in enabled Logfile:
Controller.php(1047): The requested website idSite is not found in the request, or is invalid.
ERROR Piwik\ExceptionHandler[2022-03-30 18:51:23 UTC] [a1ccd] Please check that you are logged in Matomo and have permission to access the specified website. [Query: ?date=yesterday&module=Live&format=html&forceView=1&viewDataTable=VisitorLog&action=getLastVisitsDetails&smalidSite=1&period=day&segment=&widget=&showtitle=1&random=2051, CLI mode: 0]
Also after 4 days, tracking seems to work well, but Visitor Log still shows this error
No other error is logged even with INFO

Possible Solution

Steps to Reproduce (for Bugs)

  1. Log in
  2. select Visitor Log

Context

Your Environment

  • Matomo Version: 4.8.0
  • PHP Version: 7.4.28
  • Server Operating System: Linux
  • Additionally installed plugins:
  • Browser: Firefox
  • Operating System: Windows
@bx80 commented on March 31st 2022 Contributor

Hi @artif-AndreasBrus, thanks for reporting this. That request url looks invalid:

date=yesterday&module=Live&format=html&forceView=1&viewDataTable=VisitorLog&action=getLastVisitsDetails&smalidSite=1&period=day&segment=&widget=&showtitle=1&random=2051

The parameter that specifies the site should be idSite=1 whereas that url has the value smalidSite=1. This is preventing Matomo from determining the correct site to show and results in the error you are seeing.

Unfortunately I can't recreate this using 4.8.0.

Do you have any url rewrite rules set up on the web server hosting Matomo which could be changing the request URL?

@artif-AndreasBrus commented on March 31st 2022

The URL that I can copy from Browser looks different.
https://xxx.xxx.xxx/matomo/index.php?module=CoreHome&action=index&idSite=1&period=day&date=yesterday#?idSite=1&period=day&date=yesterday&category=General_Visitors&subcategory=Live_VisitorLog

But From Dev-Console:
First POST with Result 301:
curl 'https://xxx.xxx.xxx/matomo/index.php?date=yesterday&module=Live&format=html&forceView=1&viewDataTable=VisitorLog&action=getLastVisitsDetails&small=1&idSite=1&period=day&segment=&widget=&showtitle=1&random=2781' -X POST -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:98.0) Gecko/20100101 Firefox/98.0' -H 'Accept: text/html, /; q=0.01' -H 'Accept-Language: de,en;q=0.7,en-US;q=0.3' -H 'Accept-Encoding: gzip, deflate, br' -H 'Referer: https://xxx.xxx.xxx/matomo/index.php?module=CoreHome&action=index&idSite=1&period=day&date=yesterday' -H 'X-Requested-With: XMLHttpRequest' -H 'Origin: https://xxx.xxx.xxx/' -H 'Connection: keep-alive' [...]

Returned Headers are:

HTTP/1.1 301 Moved Permanently
Date: Thu, 31 Mar 2022 04:08:30 GMT
Server: Apache
Strict-Transport-Security: max-age=63072000; includeSubDomains
X-Frame-Options: SAMEORIGIN
Location: https://xxx.xxx.xxx/matomo/index.php?date=yesterday&module=Live&format=html&forceView=1&viewDataTable=VisitorLog&action=getLastVisitsDetails&smalidSite=1&period=day&segment=&widget=&showtitle=1&random=2781
Cache-Control: max-age=0
Expires: Thu, 31 Mar 2022 04:08:30 GMT
Content-Length: 531
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
https://xxx.xxx.xxx/matomo/index.php?date=yesterday&module=Live&format=html&forceView=1&viewDataTable=VisitorLog&action=getLastVisitsDetails&small=1&idSite=1&period=day&segment=&widget=&showtitle=1&random=2781

here is the problem.
from
&action=getLastVisitsDetails&small=1&idSite=1&period=day
in the POST-Request
the 301 Location Header shows:
&action=getLastVisitsDetails&smalidSite=1&period=day

Next Request in DEV-Console is:
curl 'https://xxx.xxx.xxx/matomo/index.php?date=yesterday&module=Live&format=html&forceView=1&viewDataTable=VisitorLog&action=getLastVisitsDetails&smalidSite=1&period=day&segment=&widget=&showtitle=1&random=2781' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:98.0) Gecko/20100101 Firefox/98.0' -H 'Accept: text/html, /; q=0.01' -H 'Accept-Language: de,en;q=0.7,en-US;q=0.3' -H 'Accept-Encoding: gzip, deflate, br' -H 'X-Requested-With: XMLHttpRequest' -H 'Referer: https://xxx.xxx.xxx/matomo/index.php?module=CoreHome&action=index&idSite=1&period=day&date=yesterday' [...]

Return from Server:
Header:
HTTP/1.1 500 Internal Server Error
Date: Thu, 31 Mar 2022 04:08:30 GMT
Server: Apache
X-Matomo-Request-Id: d5964
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Pragma: no-cache
[...]

Content:
Error: The requested website idSite is not found in the request, or is invalid. Please check that you are logged in Matomo and have permission to access the specified website.

I'm very sorry for this. You are totally right!
I didn't find the rewrite rule in the first step becaus it was not "l=1" as I searched for.
I have no idea why someone wanted to eliminate the L-Parameter and why ignoring cases
For whatever reason this was .htaccess Rewrite Rule for TYPO3-Website
The whole rule was:

RewriteCond %{REQUEST_URI} !^/typo3/(.)
RewriteCond %{QUERY_STRING} ^(.
)&?L=[^&]+&?(.)$ [NC]
RewriteRule ^/?(.
)$ /$1?%1%2 [R=301,L]

Thank you very much for your fast response and for helping me solving this.

@artif-AndreasBrus commented on March 31st 2022

Sorry forgot to close. Thanks again

This Issue was closed on March 31st 2022
Powered by GitHub Issue Mirror