Block Direct Requests

This commit is contained in:
2025-08-01 01:44:23 +01:00
parent db9c114bfe
commit dea3c68510
4 changed files with 85 additions and 58 deletions
+2 -1
View File
@@ -23,13 +23,14 @@ func main() {
r.Use(cors.Handler(cors.Options{
//AllowedOrigins: []string{"https://*", "http://*"}, //* Use this for development
AllowedOrigins: GetEnvList("ALLOWED_ORIGINS", []string{"https://lk-api-temp.onrender.com"}), //* Use this for production
AllowedOrigins: GetEnvList("ALLOWED_ORIGINS", []string{"https://utils.fernandovideira.com"}), //* Use this for production
AllowedMethods: []string{"GET"},
AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token"},
ExposedHeaders: []string{"Link"},
AllowCredentials: false,
MaxAge: 300,
}))
r.Use(RefererCheck(GetEnvList("ALLOWED_ORIGINS", []string{"https://utils.fernandovideira.com"})))
r.Use(RateLimiter(rps, burst))
r.Route("/v1", func(r chi.Router) {