Browse Source

Removed stupid CORS error

ImMALWARE 4 months ago
parent
commit
fb7d734c40
1 changed files with 2 additions and 0 deletions
  1. 2 0
      http.go

+ 2 - 0
http.go

@@ -59,6 +59,7 @@ func StartHTTPSServer(port int, certFile, keyFile string) error {
 }
 }
 
 
 func handleRoot(w http.ResponseWriter, r *http.Request) {
 func handleRoot(w http.ResponseWriter, r *http.Request) {
+	w.Header().Set("Access-Control-Allow-Origin", "*")
 	if !rateLimitAllow(r.RemoteAddr) {
 	if !rateLimitAllow(r.RemoteAddr) {
 		http.Error(w, "Rate limit exceeded", http.StatusTooManyRequests)
 		http.Error(w, "Rate limit exceeded", http.StatusTooManyRequests)
 		return
 		return
@@ -314,6 +315,7 @@ type Choice struct {
 }
 }
 
 
 func handleChatCompletions(w http.ResponseWriter, r *http.Request) {
 func handleChatCompletions(w http.ResponseWriter, r *http.Request) {
+	w.Header().Set("Access-Control-Allow-Origin", "*")
 	if !rateLimitAllow(r.RemoteAddr) {
 	if !rateLimitAllow(r.RemoteAddr) {
 		http.Error(w, "Rate limit exceeded", http.StatusTooManyRequests)
 		http.Error(w, "Rate limit exceeded", http.StatusTooManyRequests)
 		return
 		return