0
0
Supabasecloud~20 mins

CORS configuration in Supabase - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
CORS Configuration Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding CORS Purpose

What is the main reason to configure CORS (Cross-Origin Resource Sharing) in a Supabase project?

ATo automatically backup Supabase data to another region
BTo encrypt data stored in Supabase databases
CTo speed up database queries by caching results
DTo allow web applications from different origins to securely access Supabase APIs
Attempts:
2 left
💡 Hint

Think about why browsers restrict web pages from calling APIs on different domains.

Configuration
intermediate
2:00remaining
Correct CORS Origin Setting

You want to allow only your website https://myapp.example.com to access your Supabase API. Which CORS origin setting is correct?

Ahttps://myapp.example.com
B*
Chttp://myapp.example.com
Dmyapp.example.com
Attempts:
2 left
💡 Hint

Remember CORS origins must include the scheme (http or https) and be exact.

Architecture
advanced
2:00remaining
Impact of Incorrect CORS Configuration

If you set CORS origin to * in Supabase, what is a likely security risk?

AAny website can make requests to your Supabase API, potentially exposing user data
BYour Supabase database will become read-only
CYour API will reject all requests from browsers
DYour Supabase project will automatically scale down
Attempts:
2 left
💡 Hint

Think about what allowing all origins means for API access.

service_behavior
advanced
2:00remaining
Behavior of Supabase API with Missing CORS Header

What happens when a browser calls a Supabase API from an origin not listed in the CORS configuration?

AThe browser automatically retries the request with CORS headers
BThe API call succeeds and returns data normally
CThe browser blocks the response due to missing CORS headers, so the frontend cannot read the data
DThe Supabase API returns a 403 Forbidden error
Attempts:
2 left
💡 Hint

Consider how browsers enforce CORS policies on responses.

security
expert
2:00remaining
Best Practice for CORS in Supabase with Multiple Frontends

You have two frontend apps: https://app1.example.com and https://app2.example.com. How should you configure CORS in Supabase to allow both securely?

ASet CORS origin to <code>https://app1.example.com https://app2.example.com</code> as a single string
BList both origins explicitly in the CORS settings separated by commas
CSet CORS origin to <code>https://example.com</code> without subdomains
DSet CORS origin to <code>*</code> to allow all origins
Attempts:
2 left
💡 Hint

Check how Supabase expects multiple origins to be listed.