No 'Access-Control-Allow-Origin' header is present on the requested resource

cengizhdde

Mitglied
Hallo zusammen,

ich weiss nicht ob ich mit meiner Frage im Forum "PHP" richtig bin. Falls so, - an die Administration - bitte um entsprechende Plazierung.

Ich arbeite an einer Anwendung mit PHP, AngularJS und HTML. Heute habe ich in der .htaccess-Datei die sichere Verbindung SSL aktiviert. Die .htaccess sieht wie folgt aus:

RewriteEngine On
# RewriteCond %{HTTP_HOST} ^xxxxx\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} ssl
RewriteRule ^(.*)$ [Internal] (https://www.xxxxx.com)/$1 [R,L]

In meiner PHP-Klasse (CakePHP) sind folgende Zeilen angegeben:

$this -> response -> header('Access-Control-Allow-Origin', '*');
$this -> response -> header('Access-Control-Allow-Methods', 'PUT, POST, GET, OPTIONS, DELETE', 'QUERY');
$this -> response -> header('Access-Control-Allow-Headers', 'Origin, Content-Type, Accept, Authorization, X-Request-With');

Beabsichtigt wird, dass, wenn der Anwender "http://xxxxx.com/ssl/xyz.html" oder "http://www.xxxxx.com/ssl/xyz.html" eingibt, er auf "https://......." weitergeleitet wird.

Erhalten tue ich folgende Fehlermeldung:

"XMLHttpRequest cannot load https://www.xxxxx.com/app/view/ssl/login.html. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://xxxxx.com' is therefore not allowed access."

Ich verstehe nicht, warum, obwohl ich den Wert "Access-Control-Allow-Origin" mit einem Stern angegeben habe, die Fehlermeldung immer noch auf eine Domain-Adresse verweist.

Kann jemand bitte helfen?

Danke,
Cengiz
 
Zurück