Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stripping trailing slash from PHP Script Path and Javascript Path causes unnecessary webserver redirects when using "js/" #30

Closed
gwharton opened this issue Apr 30, 2018 · 5 comments

Comments

@gwharton
Copy link

Hi,

To get around the adblock issue, piwik (or should I now say Matamo) recommend that you use the script paths "js/" instead of "piwik.js" and "piwik.php" as "js/" is automatically handled by Matamo, and not blocked by Adblock.

However, when the henhed module makes the call, the trailing slash is removed and the url "js" is called. This causes the webserver to respond with a redirect to "js/". Whilst it all still works, it means two webserver calls instead of one for every page view.

What is the reason for removing the trailing slash?

Thanks

Graham

@henkelund
Copy link
Collaborator

Hi Graham,

I don't think there's any specific reason for removing trailing slashes, just a simple way of normalizing the file name. I wasn't even aware that omitting the file name was an option in Matomo.

I've pushed an update to the 2.0.2 branch that only removes leading slashes and white space. You can try it out with composer require henhed/module-piwik:2.0.2.x-dev. Please let me know if that fixes your issue.

If you're trying to get around ad blockers, you might find the discussion in issue #3 interesting.

Cheers!

@gwharton
Copy link
Author

gwharton commented May 6, 2018

Yeah, I read that thread on adblockers, but it seemed like a whole lotta work when Matamo have already addressed it by allowing you to use the path js/ instead of piwik.js and js/ instead of piwik.php.

Its all detailed in their README file https://github.com/matomo-org/matomo/blob/master/js/README.md

I'll check out the update to 2.0.2 branch. Like I say, its low priority. It still works, it just means there is an unnecessary redirect from js to js/

@gwharton
Copy link
Author

gwharton commented May 6, 2018

I have applied the 2.0.2 dev commit to my local install and all seems fine.

https://tools.pingdom.com/ now reports 2 less redirects on every page of my site. :)

@gwharton
Copy link
Author

gwharton commented May 6, 2018

Look forward to the next release. Best wishes. Graham

@gwharton gwharton closed this as completed May 6, 2018
@henkelund henkelund mentioned this issue May 6, 2018
@henkelund
Copy link
Collaborator

v2.0.2 is released now.

Thank you for your feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants