Content type application/json breaks JSONP · Issue #7075 · matomo-org/matomo · GitHub
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

Content type application/json breaks JSONP #7075

Closed
everflux opened this issue Jan 26, 2015 · 5 comments
Closed

Content type application/json breaks JSONP #7075

everflux opened this issue Jan 26, 2015 · 5 comments
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement.
Milestone

Comments

@everflux
Copy link

I get this error in the chrome console

Failed to load resource: the server responded with a status of 500 (Internal Server Error) (20:52:42:320 | error, network)
  at https://example.com/?module=API&callback=jQuery19108562055646907538_1422301960073&method=VisitsSummary.get&idSite=1&call=&format=JSON&jsonp=callback&token_auth=deadbeef&date=2015-01-26&period=month&_=1422301960074
> 

This seems to be cause by a wrong mime type, owncloud has implemented an according change:
owncloud/core@eecd4bd referenced in this issue: owncloud/core#7869

Steps to reproduce:
Use JSONP with host that has

X-Content-Type-Options: nosniff

header set.

@tsteur tsteur added the Bug For errors / faults / flaws / inconsistencies etc. label Jan 26, 2015
@tsteur tsteur added this to the Piwik 2.11.0 milestone Jan 26, 2015
@tsteur tsteur added the Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement. label Jan 26, 2015
@tsteur
Copy link
Member

tsteur commented Jan 26, 2015

This is probably the related code that causes it: https://github.com/piwik/piwik/blob/2.11.0-b3/plugins/API/Renderer/Json.php#L72

@everflux can this be reproduced in any browser?

@everflux
Copy link
Author

I tested it with Chromium and got the error message above. It did not yet investigate with Firefox.

@everflux
Copy link
Author

I just noticed that I pasted the wrong error message, sorry for any confusion. The internal server error seems to be caused by a different thing, the real message was the same as in the referenced owncloud bug: content type is not executable and therefore blocked.

@tsteur tsteur self-assigned this Jan 27, 2015
tsteur added a commit that referenced this issue Jan 27, 2015
@tsteur
Copy link
Member

tsteur commented Jan 27, 2015

Thx! It should be fixed. Feel free to apply the patch if you want to test it. Please reopen in case you still experience the error afterwards. I tested it and get application/json when not using JSONP and application/javascript when using JSONP

@tsteur tsteur closed this as completed Jan 27, 2015
@everflux
Copy link
Author

Great, thank you. If I have some time to check it before the release I will post resuts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement.
Projects
None yet
Development

No branches or pull requests

2 participants