Handles remote 4xx and 5xx responses and logs them - #171
Open
foldleft wants to merge 1 commit into
Open
Conversation
At present if the remote service returns an error, we get an undifferentiated 500 back from zotero. This means we cannot distinguish between a 403, a 404 or a 500 – and so we cannot easily debug why specific sites are giving our upstream citoid server issues. Change-Id: I6db4f3f7f8b2813a6c9ff09061379a7cec17cea7
Contributor
|
I definitely agree a 500 doesn't make sense here for these kinds of errors. I'm not sure a 501 makes sense because I think of that as being a server to handle the request in the service, not one upstream... would something in the 4xx make more sense/ be something Zotero would be willing to merge? |
Author
|
I think 500 or 503 are appropriate – it's not quite acting as a gateway, but 503 does get the sense of the error being because of a downstream service. The 501 there is just a temporary nginx configuration I set up for testing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
At present if the remote service returns an error we get an undifferentiated 500 back from translation-server. This means we cannot distinguish between a 403, a 404 or a 500. This change allows us to log what happened.
Testing
I created a directory called
nginx-force-responseand populatedconf.d/default.confwith a file like this (but with more entries):And then used it like so:
docker run --rm --name nginx -v $PWD/conf.d:/etc/nginx/conf.d -p 8080:80 nginxFinally, I was able to test like this: