Frontend System Design Course
Frontend System Design
/
Intermediate

CORS

Definition

Cross-Origin Resource Sharing is a browser security mechanism that blocks web pages from making HTTP requests to a different domain than the one that served the web page, unless the target server explicitly sends CORS headers.

Explain Like I'm New

If you are on `google.com`, your browser will block any JS trying to secretly fetch data from `yourbank.com`, unless yourbank.com explicitly says 'I allow google.com to talk to me.'

Interview Questions

basic

  • What is the core concept of CORS?
  • What are the pros and cons of CORS?

intermediate

  • How does CORS impact SEO and initial page load times?
  • When would you NOT choose to use CORS?

advanced

  • How does CORS fit into a heavily scaled microservices architecture?
  • What are the security implications of CORS?

trick

  • Can you combine CORS with other rendering strategies on the same page?

Flash Cards

Question

Define CORS.

Click to reveal answer
Answer

CORS is a critical architectural pattern in frontend design.

Question

What is the main tradeoff of CORS?

Click to reveal answer
Answer

Usually a tradeoff between Server CPU usage, TTFB (Time to First Byte), and Client CPU usage.