dice icon indicating copy to clipboard operation
dice copied to clipboard

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

Open rishavvajpayee opened this issue 1 year ago • 2 comments

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

rishavvajpayee avatar Oct 01 '24 17:10 rishavvajpayee

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

iRittikSharma avatar Oct 01 '24 19:10 iRittikSharma

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

rishavvajpayee avatar Oct 02 '24 19:10 rishavvajpayee

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

lucifercr07 avatar Oct 04 '24 15:10 lucifercr07