Disable authentication for OPTIONS requests in Tomcat

喜夏-厌秋 提交于 2020-02-06 05:56:30

问题


I have an API protected by basic auth. When I want to make AJAX requests against the API, the browser send an OPTIONS request which doesn't carry the Authorization header so it gets rejected and thus my AJAX call is not allowed by the browser.

I tried to configure Tomcat to not authenticate OPTIONS requests but I don't manage to get it work.

Someone to help me to get it works?

Thanks :)


回答1:


I found the solution, I had to specify the list of HTTP methods on which the authentication was applied. Default is to apply on all methods.



来源:https://stackoverflow.com/questions/32889585/disable-authentication-for-options-requests-in-tomcat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!