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

Improve error handling by returning appropriate HTTP status codes #9737

Open
2 tasks done
0xSysR3ll opened this issue Dec 26, 2024 · 2 comments
Open
2 tasks done

Improve error handling by returning appropriate HTTP status codes #9737

0xSysR3ll opened this issue Dec 26, 2024 · 2 comments

Comments

@0xSysR3ll
Copy link

Prerequisites

  • I have searched for duplicate or closed feature requests
  • I have searched for plugins that provide already provide the feature

Proposal

Hello,

I don't know if it's already been mentioned or if it's deliberate not to implement it this way but.

Currently, when a file is not found (e.g., a missing template or resource), Roundcube displays an error page with a message such as:

FILE NOT FOUND
The requested resource was not found!
Please contact your server-administrator.

However, the server still responds with an HTTP status code of 200 OK.
This behavior can mislead monitoring systems and end-users, as it does not reflect the actual error condition.

I propose enhancing the error handling logic to return a 404 Not Found HTTP status code for missing files or resources instead of 200 OK.
This adjustment would ensure the response accurately represents the error state.

Motivation and context

Returning a 404 Not Found status for missing files instead of 200 OK would make it easier for monitoring tools to detect and classify errors accurately.

@alecpl
Copy link
Member

alecpl commented Jan 1, 2025

This might be as simple as adding http_response_code($HTTP_ERR_CODE); somewhere in program/actions/utils/error.php.

@0xSysR3ll
Copy link
Author

Yes, that's exactly what I was thinking!

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

No branches or pull requests

2 participants