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

Make sure OPTIONS requests to the REST API always return a success status code #614

Closed
acelaya opened this issue Jan 11, 2020 · 0 comments · Fixed by #616
Closed

Make sure OPTIONS requests to the REST API always return a success status code #614

acelaya opened this issue Jan 11, 2020 · 0 comments · Fixed by #616
Assignees
Labels
Milestone

Comments

@acelaya
Copy link
Member

acelaya commented Jan 11, 2020

How Shlink is set-up

  • Shlink Version: All
  • PHP Version: All
  • How do you serve Shlink: All
  • Database engine used: All

Summary

Currently, when a CORS request is performed from the browser, and the browser performs a preflight (OPTIONS) request, that request returns the same status code that would return for the request with the regular request method.

That makes requests to invalid URLs return a non-successful status code on the preflight request, which in turn makes the browser not to perform the next request.

Current behavior

OPTIONS requests return non 2xx status codes in some circumstances.

Expected behavior

OPTIONS requests always return 2xx status codes, even if the next request is going to return an unsuccessful status code.

How to reproduce

Perform an OPTIONS request to a URL starting with /rest that would not match any URL if performed with any other request method.

@acelaya acelaya added the bug label Jan 11, 2020
@acelaya acelaya self-assigned this Jan 11, 2020
@acelaya acelaya modified the milestones: 2.1.0, 2.0.2 Jan 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant