Skip to content

Commit f1defc1

Browse files
committed
update after PR 711
1 parent 03d64ba commit f1defc1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

api.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7423,7 +7423,10 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
74237423
$response = $this->responder->error(ErrorCode::ORIGIN_FORBIDDEN, $origin);
74247424
} elseif ($method == 'OPTIONS') {
74257425
$response = ResponseFactory::fromStatus(ResponseFactory::OK);
7426-
$allowHeaders = $this->getProperty('allowHeaders', 'Content-Type, X-XSRF-TOKEN, X-Authorization, X-Debug-Info, X-Exception-Name, X-Exception-Message, X-Exception-File');
7426+
$allowHeaders = $this->getProperty('allowHeaders', 'Content-Type, X-XSRF-TOKEN, X-Authorization');
7427+
if ($this->debug) {
7428+
$allowHeaders = implode(', ', array_filter([$allowHeaders, 'X-Exception-Name, X-Exception-Message, X-Exception-File']));
7429+
}
74277430
if ($allowHeaders) {
74287431
$response = $response->withHeader('Access-Control-Allow-Headers', $allowHeaders);
74297432
}
@@ -7439,7 +7442,10 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
74397442
if ($maxAge) {
74407443
$response = $response->withHeader('Access-Control-Max-Age', $maxAge);
74417444
}
7442-
$exposeHeaders = $this->getProperty('exposeHeaders', 'X-Debug-Info, X-Exception-Name, X-Exception-Message, X-Exception-File');
7445+
$exposeHeaders = $this->getProperty('exposeHeaders', '');
7446+
if ($this->debug) {
7447+
$exposeHeaders = implode(', ', array_filter([$exposeHeaders, 'X-Exception-Name, X-Exception-Message, X-Exception-File']));
7448+
}
74437449
if ($exposeHeaders) {
74447450
$response = $response->withHeader('Access-Control-Expose-Headers', $exposeHeaders);
74457451
}

0 commit comments

Comments
 (0)