Ich versuche zu get json Daten impliment von einer geruhsamen URL von localhost mit AngularJS-1-Anwendung zu schlagen.Wie Cross-Origin Resource Sharing (CORS) im Spiel-Framework 2.5.x
Ich erhalte diesen Fehler
http://localhost:9000/mlm/user/all Failed to load resource:
the server responded with a status of 404 (Not Found)
index.html:1 XMLHttpRequest cannot load http://localhost:9000/mlm/user/all.
Response to preflight request doesn't pass access control check:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://localhost:63342' is therefore not allowed access.
The response had HTTP status code 404.
Ich verwende Play-Framework 2.5.4 (Java).
Edit 1: Hinzugefügt CORS Einstellungen
play.filters {
cors {
# Filter paths by a whitelist of path prefixes
pathPrefixes = ["/"]
# The allowed origins. If null, all origins are allowed.
allowedOrigins = null
# The allowed HTTP methods. If null, all methods are allowed
allowedHttpMethods = ["GET", "POST"]
allowedHttpHeaders = ["Accept"]
preflightMaxAge = 3 days
}
}
Was ist "pathPrefixes"? –
hinzugefügt diese Zeile immer noch den gleichen Fehler –
Preflight-Anfrage verwendet Optionen-Methode, versuchen, Optionen zu allowedHttpMethods – Mikalai