Skip to content

Commit

Permalink
fix: update cors
Browse files Browse the repository at this point in the history
Signed-off-by: Chirag Ghosh <[email protected]>
  • Loading branch information
chirag-ghosh committed Jun 17, 2024
1 parent fb25207 commit 3c67d69
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,18 @@ func main() {

initMailer()

generalCors := cors.New(cors.Options{
AllowedOrigins: []string{"http://localhost:5173", "https://heimdall.metakgp.org"},
AllowCredentials: true,
})

specialCors := cors.AllowAll()

mux := http.NewServeMux()
mux.HandleFunc("/campus-check", handleCampusCheck)
mux.HandleFunc("/get-otp", handleGetOtp)
mux.HandleFunc("/verify-otp", handleVerifyOtp)
mux.HandleFunc("/validate-jwt", handleValidateJwt)
mux.Handle("/campus-check", specialCors.Handler(http.HandlerFunc(handleCampusCheck)))
mux.Handle("/get-otp", generalCors.Handler(http.HandlerFunc(handleGetOtp)))
mux.Handle("/verify-otp", generalCors.Handler(http.HandlerFunc(handleVerifyOtp)))
mux.Handle("/validate-jwt", generalCors.Handler(http.HandlerFunc(handleValidateJwt)))

handler := cors.AllowAll().Handler(mux)

Expand Down

0 comments on commit 3c67d69

Please sign in to comment.