In a complex CORS scenario, how can you selectively allow certain types of requests while denying others?
- Create custom middleware
- Set Access-Control-Allow-Origin to *
- Use the OPTIONS method
- Configure server-side routing
In complex CORS scenarios, you can selectively allow or deny requests by creating custom middleware on your server. This middleware can inspect the request headers, methods, or other criteria to determine whether to allow or deny a request. The other options are components of CORS but do not provide fine-grained control over request types.
Loading...
Related Quiz
- When using stubs, the main focus is on ______ rather than on verifying interactions between objects.
- In which of the following template engines can you write plain JavaScript code inside special tags?
- How can you match routes with a specific pattern in Express.js?
- Which of the following is true regarding built-in middlewares in Express.js?
- You are developing an application with multiple user roles, and each role has different levels of access to resources. How would you securely implement role-based access control to prevent unauthorized access?