[Vuejs]-Wrong response from the server – It seems my FrontEnd is getting Options response instead of Post

-1👍

Actually my problem wasn’t related to options method as I thought, the problem was that I was missing the Access-Control-Expose-Headers which should also be presented in the headers of server response.

I just set it on my springboot app and it worked fine !

List<String> exposedHeaders = Arrays.asList("Authorization");
configuration.setExposedHeaders(exposedHeaders);

I got the answer from this one: axios response headers missing data when running in vuejs app

0👍

I can reproduce your Postman request with curl:

curl -vv -H "Content-Type: application/x-www-form-urlencoded" http://ec2-52-4-252-232.compute-1.amazonaws.com:9090/login -d '{"username":"admin", "password":"password"}'

Returns a 200 with the Authorization header filled in.

Can you run the frontend code with the Network tab in Developer Tools open and see how the POST request looks?
And possibly right-click and "copy as cURL" and then compare it to the curl request above.

Leave a comment