Hello,
I am having some issue with the CORS using warp
I have an API and i try to determine which method i am allowed to use.
My api is like:
let login = warp::path("login")
.and(warp::post())
.and(warp::body::json())
.and_then(handlers::authentication::login_user); // login
let routes = register
.or(login)
.or(logout)
.with(warp::cors().allow_any_origin().allow_methods(vec!["OPTIONS", "GET", "POST", "DELETE", "PUT"]));
.recover(error::handle_rejection);
My code compile well, but when i:
curl -X OPTIONS 'http://127.0.0.1:3030/login' -v
I get an error telling me the method is not allowed !!
The issue is that my browser sends an OPTIONS request before the POST request used to login.
The OPTIONS request get a 403 reply followed by a POST request that is blocked !!
Is there any missuse with the cors features?