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

Only set error 500 headers when there is an internal server error (Database failure) #6375

Closed
mgazdzik opened this issue Oct 2, 2014 · 2 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc.

Comments

@mgazdzik
Copy link
Contributor

mgazdzik commented Oct 2, 2014

In https://github.com/piwik/piwik/blob/master/core/testMinimumPhpVersion.php#L93 code 500 is assumed if no other headers are present.
However, when comparing Apache2 + php5 mod vs nginx + php-fpm it turns out that invalid request throws 200 code on apache and 500 on nginx. This causes difficulties while trying to find actual issue on server running nginx with custom 4xx and 5xx pages.

Ugly fix: before throwing exception set code 200 headers ?
However I'm not sure if even this default 500 is required actually.

Any thougts ?

@mattab
Copy link
Member

mattab commented Oct 6, 2014

On Apache+Php5 I'm seeing the proper error 500 being set:
error500

For this URL : index.php?module=CoreHome&action=index&idSite=X

How can I reproduce your issue?

@mattab mattab added the Bug For errors / faults / flaws / inconsistencies etc. label Oct 6, 2014
@mattab mattab added this to the Short term milestone Oct 6, 2014
@mgazdzik
Copy link
Contributor Author

mgazdzik commented Oct 7, 2014

If you can reproduce 500 error code on apache, then the next step would be to set custom 5xx error page. Problem lies in situation where end-user is being displayed custom and non-relevant message about 500 error, while it was actually Piwik exception which has it's verbose explaination (for example when user logs in but doesn't have any view/admin permissions. he normally would be displayed with instructions on what to do, but 5xx error page is served).

I've thought about this issue and perhaps custom error pages served and styled by Piwik would be some kind of solution to display relevant messages so users don't get confused ?

@mattab mattab changed the title Different response codes for Apache and Nginx when exception thrown Only set error 500 headers when there is an internal server error (Database failure) Oct 9, 2014
@mattab mattab closed this as completed in 3f6141c Oct 9, 2014
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.
Projects
None yet
Development

No branches or pull requests

2 participants