DiceDB / dice

DiceDB is a redis-compliant, in-memory, real-time, and reactive database optimized for modern hardware and for building and scaling truly real-time applications.
https://dicedb.io/
Other
6.58k stars 1.04k forks source link

Add CORS Middleware to playground-mono for Enhanced Security and Flexibility #894

Closed rishavvajpayee closed 3 weeks ago

rishavvajpayee commented 3 weeks ago

Implement Cross-Origin Resource Sharing (CORS) middleware in the playground-mono backend to control which domains can access API resources. This will enhance security and allow flexible configurations for different environments

  1. Create a CORS middleware in the middleware package: • Allow specific origins by setting Access-Control-Allow-Origin based on the environment configuration. • Include headers for allowed methods and allowed headers. • Handle OPTIONS requests with a proper 200 OK response.

  2. Update LoadConfig() in the config package to support the new ALLOWED_ORIGINS configuration: • Parse a comma-separated string from an environment variable into a slice of strings.

  3. Add CORS to all applicable routes in the main.go file or route initialization

iRittikSharma commented 3 weeks ago

@lucifercr07 I would like to work on this issue could you please assign it to me

rishavvajpayee commented 3 weeks ago

related PR : https://github.com/DiceDB/playground-mono/pull/13

lucifercr07 commented 3 weeks ago

Closing, merged as part of https://github.com/DiceDB/playground-mono/pull/13