Giter VIP home page Giter VIP logo

Comments (15)

brtptrs avatar brtptrs commented on July 24, 2024

I have cleared all caches in Firefox and reinstalled the app after uninstalling. I also get the same behaviour an different machines. PC, Notebook and Android.
Same error also in Chrome 70

from cloud_piwik.

sualko avatar sualko commented on July 24, 2024

I'm sorry that you have trouble with the latest release, but I need some more help from you. The 404 is quite unusual for Nextcloud, because normally you get a 302 if you try to access an not existing route. What happens if you try to download /apps/piwik/js/tracking.js directly? Is the 404 from your webserver or Nextcloud? Do you have any related log entry in your web server or NC log? If you don't use any rewriting the url should be something like index.php/apps/piwik/.... Do you use rewriting?

from cloud_piwik.

brtptrs avatar brtptrs commented on July 24, 2024

Calling apps/piwik/js/tracking.js directly returns a "file not found" error.
We don't do any fancy stuff on the nextcloud installation. Nextcloud is installed in a subdirectory, that's the only slightly unusual point.

from cloud_piwik.

brtptrs avatar brtptrs commented on July 24, 2024

Interesting is: Viewing the source code of the "page-not-found" error page does show the js code.
view-source:https://path-to-mycloud/apps/piwik/js/tracking.js

*!

/* global OC */

var _paq = _paq || [];
......

from cloud_piwik.

sualko avatar sualko commented on July 24, 2024

Are you sure that you don't use url rewriting? Because normally the url should look like http://localhost/nextcloud/index.php/apps/piwik/js/tracking.js. The index.php is the important part here, but anyway what I meant above was that if you request something like http://localhost/nextcloud/index.php/apps/files404/ you get an 302 and not an 404. A 404 means the Nextcloud is not involved.

My guess is that you messed up your rewrite config. Look overwrite.cli.url and htaccess.RewriteBase in your nc config and check your server config.

Btw I tested both setups: With and without url rewriting and I can't reproduce your issue. Sorry.

from cloud_piwik.

brtptrs avatar brtptrs commented on July 24, 2024

I just had a look at the code inside the "cloud_piwik-0.5.0.tar.gz" release, it seems the is no file called "tracking.js" in piwik/js. Only a file called "track.js". Is this correct?
On out live server there is no "tracking.js" file after an online upgrade either.

from cloud_piwik.

sualko avatar sualko commented on July 24, 2024

That's right. It's using a Nextcloud route and this is also the reason why there should be an index.php in the path if you don't use rewriting.

from cloud_piwik.

le-yak avatar le-yak commented on July 24, 2024

I experienced the exact same behaviour as @brtptrs (Nextcloud v.15.0.2 / cloud_piwik v0.5.0).
I believe it has something to do with which URL are allowed by default in Nextcloud, I recall reading something like this during my investigations. Unfortunately I am unable to find the reference anymore, sorry.

Fiddling with rewrite settings didn't help.
Changing the script's URL from .../js/tracking.js to .../js/script fixed the issue for me.

from cloud_piwik.

le-yak avatar le-yak commented on July 24, 2024

After further investigations, this has nothing to do with Content Security Policy, as I came to suspect at some point.
This is my .htaccess freshly generated by occ maintenance:update:htaccess:

  DirectoryIndex index.php index.html
(removed for brevity)
  RewriteCond %{REQUEST_FILENAME} !\.(css|js|svg|gif|png|html|ttf|woff2?|ico|jpg|jpeg)$
(removed for brevity)
  RewriteRule . index.php [PT,E=PATH_INFO:$1]
  RewriteBase /

Any route ending with ".js" (or any extention that appears in the exclusion list) is ignored by the rewrite engine. Changing the route to anything else solves the problem.

Setup:

  • Apache 2.4.34
  • PHP 7.2.9 (FPM via mod_proxy_fcgi)
  • Nextcloud 15.0.4 (yup, updated 2hrs ago)
  • cloud_piwik 0.5.0
  • config.php:
  'overwrite.cli.url' => 'https://example.com',
  'htaccess.RewriteBase' => '/',

The weirdest thing of all is that I too receive the JS script in the HTTP response body (tested with curl, therefore not a browser cache thing), along with the 404 status code:

$ curl -v https://example.com/apps/piwik/js/tracking.js
< HTTP/1.1 404 Not Found
(...)
* cloud_piwik v0.5.0 - 2018-10-29
(...)

Perhaps the 404 response goes through index.php: I get an empty 404 response if I remove the DirectoryIndex directive. But I'm stopping my goose chase for now...

from cloud_piwik.

sualko avatar sualko commented on July 24, 2024

The weirdest thing of all is that I too receive the JS script in the HTTP response body

Therefore I don't believe this is related to the rewrite rule. On an other app, I had a similar issue and it was related to the returned filename. Currently tracking.js is delivered as script. Maybe this is the reason why you get a 404, with the body tag, but I'm unsure. The only thing I can say, is that it is working for me with the same rewrite rules. I will update the app and it would be great if you could give me some feedback. It would also be helpful if you could send me your url to [email protected], so I can investigate this further.

from cloud_piwik.

sualko avatar sualko commented on July 24, 2024

It would be awesome if you could test the latest release.

from cloud_piwik.

brtptrs avatar brtptrs commented on July 24, 2024

v0.5.1 unfortunately does not solve the problem for me.
Upgrade Steps (from NC front end):

  • Deactivate
  • Remove
  • Download and install

I still get a 404 on
apps/piwik/js/tracking.js

from cloud_piwik.

sualko avatar sualko commented on July 24, 2024

Can you send me your url to [email protected]?

from cloud_piwik.

brtptrs avatar brtptrs commented on July 24, 2024

@sualko done, and thank you for the effort.

from cloud_piwik.

sualko avatar sualko commented on July 24, 2024

I hope I can release a fix for this bug this weekend. Sorry for the trouble.

from cloud_piwik.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.