MySQL exceptions with long urls

(lalquier) #1

There are several pages with long URLs that I need to track.

However, my PHP error log shows MySQL exceptions when trying to insert long urls in piwik tables.

After inspection, it appears piwik allocated only VARCHAR(255) for URLs. This is too restrictive for modern applications.

Internet Explorer limits its URLs to 2083 characters. Firefox has a limit of 65000 characters.

Either the piwik schema needs to be adjusted to reflect that or the logging code needs to truncate URLs to the first 255 characters (which may limit logging options).

(vipsoft) #2

You’re welcome to alter the schema to accommodate your needs. You also have to consider the performance impact of indexing really long URLs. If the reason for your long URLs is SEF/SEO, you should consider using setCustomUrl() and setDocumentTitle().

Whether or not 256 is too short is debateable. Some sites consider extremely long URLs to be a security risk, i.e., containing exploit code as a payload, or attempt at a buffer overrun.

Also, in ticket we’ll offer a way to filter out some URL parameters.

(Matthieu Aubry) #3

we considered changing the field to TEXT in 0.5 - I created a ticket:
I think the right solution is to change the type to TEXT but still limit to 2k characters (to avoid denial of service)