Skip to content

Commit

Permalink
Fixing CORS multiple origins header
Browse files Browse the repository at this point in the history
Addresses jacwright#115
  • Loading branch information
jacwright authored Oct 17, 2018
1 parent 89f3cf5 commit 119eee4
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions source/Jacwright/RestServer/RestServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -568,9 +568,7 @@ private function corsHeaders() {
if (in_array($currentOrigin, $allowedOrigin)) {
$allowedOrigin = array($currentOrigin); // array ; if there is a match then only one is enough
}
foreach($allowedOrigin as $allowed_origin) { // to support multiple origins
header("Access-Control-Allow-Origin: $allowed_origin");
}
header('Access-Control-Allow-Origin: ' . implode(', ', $allowedOrigin));
header('Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS');
header('Access-Control-Allow-Credential: true');
header('Access-Control-Allow-Headers: X-Requested-With, content-type, access-control-allow-origin, access-control-allow-methods, access-control-allow-headers, Authorization');
Expand Down

0 comments on commit 119eee4

Please sign in to comment.