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
webapp handle each request method appropriately #11224
Merged
filipenevola
merged 6 commits into
meteor:release-2.3
from
nathan-muir:nm-webapp-request-methods
May 20, 2021
Merged
webapp handle each request method appropriately #11224
filipenevola
merged 6 commits into
meteor:release-2.3
from
nathan-muir:nm-webapp-request-methods
May 20, 2021
Conversation
This file contains 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
Fix incorrect responses, like sending content to OPTIONS requests, by implementing the following scheme: GET - Respond with the requested resource; static asset, boilerplate etc. HEAD - Return headers identical to GET request - Do not send content (Node.js will automatically skip response content) OPTIONS - Respond with 200 - Send an Allow Header listing acceptable request methods - Do not send content CONNECT, DELETE, PATCH, POST, PUT, TRACE, etc. - Respond with 405 Method Not Allowed - Send an Allow Header listing acceptable request methods - Do not send content
[RFC 7231 OPTIONS](https://tools.ietf.org/html/rfc7231#section-4.3.7) > A server generating a successful response to OPTIONS SHOULD send any header fields that might indicate optional features implemented by the server and applicable to the target resource (e.g., Allow) > A server MUST generate a Content-Length field with a value of "0" if no payload body is to be sent in the response. [RFC 7231 405 Method Not Allowed](https://tools.ietf.org/html/rfc7231#section-6.5.5) > The origin server MUST generate an Allow header field in a 405 response containing a list of the target resource's currently supported methods
66f5bc0
to
dd66cdf
Compare
StorytellerCZ
approved these changes
Apr 29, 2021
filipenevola
approved these changes
May 20, 2021
This was referenced Oct 7, 2021
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.
Hi,
This PR is just to fix some rough edges where the meteor
webapp
will respond to unsupported request methods with content, instead of responding appropriately.Examples of current misbehaviour
The following scheme should improve compliance:
GET
HEAD
GET
requestOPTIONS
CONNECT
,DELETE
,PATCH
,POST
,PUT
,TRACE
, etc.--
One issue that this PR creates, if a user has added a handler to
WebAppInternals.connectHandlers
, to handle aPOST
request body, but then still wants the boilerplate to be sent as a response. We could however, add a workaround for this case; eg, supplying an API to return the boilerplate.--
Relevant RFC's
RFC 7231 OPTIONS
RFC 7231 405 Method Not Allowed
RFC 7231 HEAD