one OPTIONS for all POST requests

故事扮演 提交于 2020-02-25 03:21:07

问题


Is there any way to have one OPTIONS request for all the subsequent POST requests.

The application communicates with the server by means of POST requests whenever required.There are many unrelated POST requests happening and for each POST request one OPTIONS is triggered to ensure CORS.Can we have one OPTIONS for all these POST requests.


回答1:


Looking here, I believe you can accomplish this by setting the "Access-Control-Max-Age" header for an arbitrarily long duration of time. This field determines how long the results from the pre-flight OPTIONS request are cached for before an additional OPTIONS request needs to be sent, so by extending it you can limit how often OPTIONS requests are sent.



来源:https://stackoverflow.com/questions/31517737/one-options-for-all-post-requests

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