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

HttpMethodValidator produces 404 instead of 405 response #24018

Open
schmengler opened this issue Aug 5, 2019 · 8 comments
Open

HttpMethodValidator produces 404 instead of 405 response #24018

schmengler opened this issue Aug 5, 2019 · 8 comments
Labels
Component: HTTP Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Priority: P3 May be fixed according to the position in the backlog. Progress: ready for dev Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.
Milestone

Comments

@schmengler
Copy link
Contributor

schmengler commented Aug 5, 2019

Summary

The validation based on the new (2.3.0+) HTTP method marker interfaces (HttpGetActionInterface, HttpPostActionInterface, ...) throw an exception that is turned into a 404 response by the front controller:

        throw new InvalidRequestException(
            new NotFoundException(new Phrase('Page not found.'))
        );

A proper response status code would be 405 Method Not Allowed.

Steps to reproduce

  1. Make a GET request to an action with HttpPostActionInterface
  2. Watch the status code received.

Expected Result

  1. 404 Not Found.

Actual Result

  1. 405 Method Not Allowed.

Proposed solution

  1. Use a different "replace result" than NotFoundException that at least returns an error page with the correct status code. Minimum solution: send correct status code
  2. Do not mis-use exceptions as results at all Architectural improvement: do not mix unrelated types
  3. Add more marker interfaces to determine the type of result, i.e. JsonActionInterface, HtmlActionInterface, ... and return a different body depending on those Ideal solution: enable handling of 405 errors in different context
@m2-assistant
Copy link

m2-assistant bot commented Aug 5, 2019

Hi @schmengler. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@schmengler do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@magento-engcom-team magento-engcom-team added the Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed label Aug 5, 2019
@engcom-Bravo engcom-Bravo self-assigned this Sep 18, 2019
@m2-assistant
Copy link

m2-assistant bot commented Sep 18, 2019

Hi @engcom-Bravo. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Bravo engcom-Bravo added Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Component: HTTP Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Sep 18, 2019
@magento-engcom-team
Copy link
Contributor

@engcom-Bravo Thank you for verifying the issue.

Unfortunately, not enough information was provided to acknowledge ticket. Please consider adding the following:

Once all required information is added, please add label "Issue: Confirmed" again.
Thanks!

@magento-engcom-team magento-engcom-team removed the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Sep 18, 2019
@ghost ghost unassigned engcom-Bravo Sep 18, 2019
@engcom-Bravo engcom-Bravo added Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed labels Sep 18, 2019
@magento-engcom-team magento-engcom-team added Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed and removed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed labels Sep 18, 2019
@engcom-Bravo engcom-Bravo added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed labels Sep 18, 2019
@magento-engcom-team magento-engcom-team added the Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed label Sep 18, 2019
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @engcom-Bravo
Thank you for verifying the issue. Based on the provided information internal tickets MC-20228 were created

Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@magento-engcom-team magento-engcom-team added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development and removed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed labels Sep 18, 2019
@anujwebkul anujwebkul self-assigned this Oct 14, 2019
@m2-assistant
Copy link

m2-assistant bot commented Oct 14, 2019

Hi @anujwebkul. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 3. If the issue is not relevant or is not reproducible any more, feel free to close it.


@ghost
Copy link

ghost commented Oct 14, 2019

@magento i am working on it.

@anujwebkul anujwebkul assigned ghost Oct 14, 2019
@m2-assistant
Copy link

m2-assistant bot commented Oct 14, 2019

Hi @vishesh-webkul. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 3. If the issue is not relevant or is not reproducible any more, feel free to close it.


@buskamuza
Copy link
Contributor

Just wanted to link the original discussion here magento/architecture#10 (comment) (the decision was to have 404).

@magento-engcom-team magento-engcom-team added this to PR In Progress in Community Backlog Mar 24, 2020
@ghost ghost added Priority: P3 May be fixed according to the position in the backlog. Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. labels Aug 18, 2020
@sidolov sidolov added this to Ready for Grooming in Low Priority Backlog Sep 3, 2020
@m2-community-project m2-community-project bot moved this from Ready for Grooming to Pull Request In Progress in Low Priority Backlog Sep 3, 2020
@m2-community-project m2-community-project bot added Progress: PR Created Indicates that Pull Request has been created to fix issue and removed Progress: PR in progress labels Sep 3, 2020
@ghost ghost added Progress: PR in progress and removed Progress: PR Created Indicates that Pull Request has been created to fix issue labels Sep 11, 2020
@sidolov sidolov added this to Ready for Development in Low Priority Backlog Sep 24, 2020
@m2-community-project m2-community-project bot moved this from Ready for Development to Pull Request In Progress in Low Priority Backlog Sep 24, 2020
@m2-community-project m2-community-project bot added Progress: PR Created Indicates that Pull Request has been created to fix issue and removed Progress: PR in progress labels Sep 24, 2020
@gabrieldagama gabrieldagama added this to the 2.5 milestone Jan 25, 2021
@m2-community-project m2-community-project bot added this to Pull Request In Progress in 2.5 Milestone Backlog Jan 25, 2021
@m2-community-project m2-community-project bot removed this from PR In Progress in Community Backlog Jan 25, 2021
@m2-community-project m2-community-project bot removed this from Pull Request In Progress in Low Priority Backlog Jan 25, 2021
@m2-community-project m2-community-project bot added this to Ready for Development in Low Priority Backlog Jun 21, 2022
@m2-community-project m2-community-project bot removed this from Pull Request In Progress in 2.5 Milestone Backlog Jun 21, 2022
@m2-community-project m2-community-project bot added Progress: ready for dev and removed Progress: PR Created Indicates that Pull Request has been created to fix issue labels Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: HTTP Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Priority: P3 May be fixed according to the position in the backlog. Progress: ready for dev Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.
Projects
Low Priority Backlog
  
Ready for Development
Development

Successfully merging a pull request may close this issue.

7 participants