-
Notifications
You must be signed in to change notification settings - Fork 77
Service responds HTTP status 504 in case of LDAP timeout #289
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks fine and tested it in docker, i can see 504 status when the timeout happen with connect timed out message.
|
Yes, 506 was just my mistype. 504 is correct. I've fixed that in the description here. |
Okay. So, we are using 504, and not ceating any custom HTTP status code? |
| cause = communicationException.getCause(); | ||
| if (cause instanceof javax.naming.CommunicationException namingCommunicationException) { | ||
| String message = namingCommunicationException.toString(); | ||
| LOGGER.warn("Communication problem: {}; {}", HttpStatus.GATEWAY_TIMEOUT, message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is GATEWAY_TIMEOUT the most appropriate HTTP status code for all possible CommunicationException scenarios?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a bit confused. I did bit of googling and 504 status code is for gate-way timeout. But, the ticket says 506 status code. I assume we are trying to create a custom HTTP status code like 506 for LDAP timeout. If that is the case, why yse 504?
Correct me if i have not understood it right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is GATEWAY_TIMEOUT the most appropriate HTTP status code for all possible CommunicationException scenarios?
You're right, strictly speaking LDAP isn't "a content delivery service" publisher depends on. But it cannot deliver response if LDAP is unavailable. That's why I used this status code.
Do you have a suggestion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a bit confused. I did bit of googling and 504 status code is for gate-way timeout. But, the ticket says 506 status code. I assume we are trying to create a custom HTTP status code like 506 for LDAP timeout. If that is the case, why yse 504?
Correct me if i have not understood it right.
Yes, should be 504. Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is GATEWAY_TIMEOUT the most appropriate HTTP status code for all possible CommunicationException scenarios?
You're right, strictly speaking LDAP isn't "a content delivery service" publisher depends on. But it cannot deliver response if LDAP is unavailable. That's why I used this status code.
Do you have a suggestion?
No, it makes sense. I am okay with the existing HTTP status code. Thank you for the response.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Applicable Issues
Description of the Change
When LDAP request timeouts, publish service responds HTTP status 504 instead of 401.
401 status confused users as they expected incorrect password was submitted.
Alternate Designs
Possible Drawbacks
Sign-off
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
Signed-off-by: Roman Szturc roman.szturc.ext@ericsson.com