Session Recording on test server

I have setup a replica of our live site on our inhouse server to try and resolve our session recording issues. So we can record sessions see how it sworking. I am using the www2 prefix for this. I am getting this error in system check

Requesting ‘https://www2.abc.com/analytics/plugins/HeatmapSessionRecording/configs.php?idsite=1&trackerid=5lX6EM&url=http%3A%2F%2Ftest.test%2F’ resulted in an error: curl_exec: failed to connect to www2.abc.com port 443: connection refused. hostname requested was: www2.abc.com. As a result, tracking Heatmaps and Session Recordings may not work. You may need to change your webserver configuration to allow access to this file via the Internet or Intranet.

What is trying to access port 443 ? The site is being served ok on https. It is behind a nginx proxy. Niginx listens on https but site is running on http.
Thanks
Paul

Hi @toomanylogins,

For Session Recording to work, the visitor of the page needs to be able to request https://www2.abc.com/analytics/plugins/HeatmapSessionRecording/configs.php. If this request fails, no sessions (and heatmaps) will be recorded.

Therefore the system check tests if it can request the https://www2.abc.com/analytics/plugins/HeatmapSessionRecording/configs.php file and according to your error fails to do so.

So can you check if you are able to request the URL from your browser correctly. If so maybe only your server isn’t setup to reach itself via HTTPS and therefore only the system check fails even though it should work for your visitors.

There is another way to avoid the configs.php request, but it needs more manual setup on the site:
https://developer.matomo.org/guides/heatmap-session-recording/faq#how-do-i-prevent-the-http-request-to-a-configsphp-on-each-page-view

Hello Lukas, config.php seems to be accessible I do not get a 404 just a blank page. As I have moved the site from www to www2 do I need to update the tracking code. At moment cannot capture any recordings ?

In my apache log I have
10.10.10.2 - - [26/Mar/2018:11:39:38 +0100] “GET /analytics/plugins/HeatmapSessionRecording/configs.php HTTP/1.0” 400 205 "-"
400 is bad request.
Any idea what may cause this ?

The HyperText Transfer Protocol (HTTP) 400 Bad Request response status code indicates that the server could not understand the request due to invalid syntax.

Just a wild guess, but maybe your server does not speak HTTP/1.0 anymore?

I think the issue relates to this post

and
https://curl.haxx.se/docs/faq.html#How_do_I_tell_curl_to_follow_HTT

An Ideas anyone

Should not be that hard to fix, but as it is a premium plugin I do not have access to the source code to take a look.

If this uses PHPs curl, you need to set CURLOPT_FOLLOWLOCATION to true.

e.g.

curl_setopt($req, CURLOPT_FOLLOWLOCATION, 1);

Hi,

Do you have access to the server? If yes, you could try curl --http1.0 https://www2.abc.com/analytics/plugins/HeatmapSessionRecording/configs.php directly.

Hello Lukas
I get error

Tried correcting the path

Sorry @toomanylogins, that was my mistake.

You need to use the http url:
curl --http1.0 https://www2.abc.com/analytics/plugins/HeatmapSessionRecording/configs.php

Thats gives the same error as system check

The issue must be running behind the nginx proxy ?

Hi Paul, yes the problem is likely the nginx config. It needs to include a whitelist for the URL path /plugins/HeatmapSessionRecording/configs.php

for example I made this change in the nginx piwik configuration here: Support Heatmaps & Session recordings: Relay all plugins/HeatmapSessionRecording/configs.php requests to fastcgi. by mattab · Pull Request #40 · perusio/piwik-nginx · GitHub

-> could you please try this change and confirm if this works for you?

Btw, what Nginx project/template did you use for your Nginx config?
Thanks,

Hello Mathieu,

Have I understood I make these changes in my nginx.conf ?

I do not have a path to include apps/piwik/fcgi_piwik_long_cache.conf;

I didnt use a template for nginx just created a new one from scratch. It just setup to reverse proxy everything.
Thanks
Paul

I have a location setting in the reverse proxy which should allow the plugins

	        location / {
        proxy_pass   http://10.10.1.19;
		proxy_set_header Host   $host;
		proxy_set_header X-Forwarded-Proto $scheme; # very important to avoid the ssl warnings in browser with http backend
		client_max_body_size 100m;			
    }

With this url in browser
https://www2.youdopet.com/analytics/plugins/HeatmapSessionRecording/configs.php?idsite=1&trackerid=5lX6EM&url=http%3A%2F%2Ftest.test%2F
I get this
Piwik.HeatmapSessionRecording.configuration.assign({“heatmaps”:[],“sessions”:[],“idsite”:1,“trackerid”:“5lX6EM”});

That’s good news, because this output is what you would expect when querying the configs.php file.

Hello Matthieu, But I still have system check error and recordings not working on www2 they are ok on www live site

Blockquote Requesting ‘https://www2.youdopet.com/analytics/plugins/HeatmapSessionRecording/configs.php?idsite=1&trackerid=5lX6EM&url=http%3A%2F%2Ftest.test%2F’ resulted in an error: curl_exec: failed to connect to www2.youdopet.com port 443: connection refused. hostname requested was: www2.youdopet.com. As a result, tracking Heatmaps and Session Recordings may not work. You may need to change your webserver configuration to allow access to this file via the Internet or Intranet.

Now I am baffled. Session recording is now working on test system as of this morning but not made any further changes.