亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - Ask about CORS security
給我你的懷抱
給我你的懷抱 2017-05-19 10:42:05
0
2
986

During the interview, I was asked about CORS security, but I couldn’t answer it. I would like to ask everyone for advice.
CORS sets Access-Control-Allow-Origin on the server side. If it is not set to *, isn't it possible that only the specified domain can initiate a request? Otherwise, it will be intercepted by the browser. I have seen that http headers can be forged. , but manually setting Origin will also be blocked by the browser. Where is the vulnerability of CORS? What's the solution? Thanks

給我你的懷抱
給我你的懷抱

reply all(2)
巴扎黑

https://developer.mozilla.org... Browser Compatibility

小葫蘆

On the contrary, I think CORS intersecting with JSONP is a safer cross-domain method and a standard cross-domain method.

Access-Control-Allow-Origin is a domain whitelist that allows requests. Only those in this domain will the server unify cross-domain requests. If the whitelist is set appropriately, CSRF attacks can be avoided.

I think this question may require you to consider the problems you face if Access-Control-Allow-Origin is *.

The ones set to * are generally public APIs. In order to avoid frequent requests or DDOS, there are usually additional steps for key verification and the frequency and number of requests are limited.

Also, although CORS does not transmit cookies by default, it can be allowed by setting Access-Control-Allow-Credentials to true, which may also lead to the risk of CSRF attacks.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template