Chapter 6. Best practices
This chapter covers
- Opening up your API to public CORS requests
- Limiting CORS requests to a whitelisted set of origins
- Ensuring your CORS responses are properly handled by proxy servers
- Protecting against cross-site request forgery (CSRF) vulnerabilities
- Configuring and minimizing preflight requests
The previous chapters showed how Access-Control prefixed HTTP headers can dictate the behavior of CORS requests. There are six CORS-specific response headers, each with its own set of valid values. This can lead to myriad ways in which the server response can be configured. While the previous chapters explained what these HTTP headers do, they didn’t offer a lot of guidance on how to best use these headers. How should ...
Get CORS in Action now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.