Conversation
We realized we made some mistakes with the directive ordering, so we're making some minor adjustments. `abort` and `error` don't really make sense to be after other handler directives, because you would expect to be able to "fail-fast" and throw an error before falling through to some `file_server` or `respond` typically. So we're moving them up to just before `respond`, i.e. before the common handler directives. This is also more consistent with our existing examples in the docs, which actually didn't work due to the directive ordering. See https://caddyserver.com/docs/caddyfile/directives/error#examples Also, `push` doesn't quite make sense to be after `handle`/`route`, since its job is to read from response headers to push additional resources if necessary, and `handle`/`route` may be terminal so push would not be reached if it was declared outside those. And also, it would make sense to be _before_ `templates` because a template _could_ add a `Link` header to the response dynamically.
5d82f6d to
4efe491
Compare
mholt
approved these changes
Aug 26, 2021
Member
mholt
left a comment
There was a problem hiding this comment.
Thanks, these are good bug fixes. Might come as a surprise to a few users who relied on this buggy ordering, but this is more correct.
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.
We realized we made some mistakes with the directive ordering, so we're making some minor adjustments.
abortanderrordon't really make sense to be after other handler directives, because you would expect to be able to "fail-fast" and throw an error before falling through to somefile_serverorrespondtypically. So we're moving them up to just beforerespond, i.e. before the common handler directives.This is also more consistent with our existing examples in the docs, which actually didn't work due to the directive ordering. See https://caddyserver.com/docs/caddyfile/directives/error#examples (added a test to prove that this example will work now, based on the
adaptoutput)Also,
pushdoesn't quite make sense to be afterhandle/route, since its job is to read from response headers to push additional resources if necessary, andhandle/routemay be terminal so push would not be reached if it was declared outside those. And also, it would make sense to be beforetemplatesbecause a template could add aLinkheader to the response dynamically.