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

Routing error / Preflight request / OPTIONS #320

Closed
sgwilym opened this issue Jul 27, 2015 · 1 comment
Closed

Routing error / Preflight request / OPTIONS #320

sgwilym opened this issue Jul 27, 2015 · 1 comment

Comments

@sgwilym
Copy link
Contributor

sgwilym commented Jul 27, 2015

I'm using j-toker to update a user’s account details, and to handle auth throughout my JS app generally. It works fine for signing in and out, and updating other resources on the API, but when I try to update the user's account with j-toker's built in method for doing so the request fails.

Serverside, I get:
Started OPTIONS "/api/v1/auth" for 127.0.0.1 at 2015-07-27 17:46:37 +0200 ActionController::RoutingError (No route matches [OPTIONS] "/api/v1/auth"):

On the browser:
XMLHttpRequest cannot load http://0.0.0.0:3000/api/v1/auth. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 404.

rack-cors is handling the OPTIONS request everywhere else , and doesn't complain about there being no matching routes. As j-toker seems to be doing it's job right for everything else, I feel like this may be something to do with devise_token_auth. Any ideas on how to handle this?


Looking at the rails server console it doesn't look like the OPTIONS requests for other resources never even hit the router. I'm really stumped.

@sgwilym
Copy link
Contributor Author

sgwilym commented Jul 27, 2015

Found the issue. Rack Cors was allowing patch but not put. 😓

@sgwilym sgwilym closed this as completed Jul 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant