Cli-server mode cannot send Access-Control-Allow-Origin header
Description
The following code:
<?php
header('Access-Control-Allow-Origin: *');
header("Access-Control-Expose-Headers: Content-Disposition");
header('Access-Control-Origin: xxx.hoo.com');
die('header test');
Resulted in this output:
I used the curl -I command to test, but did not output the first header.
But I expected this output instead:
PHP Version
PHP 7.4.3
Operating System
kde neon / Ubuntu 20.04.3 LTS
By the way, the same code is normal in nginx + php-fpm mode.
Works for me in PHP 7.4.26.
ubuntu:~/php$ cat gh7777.php
<?php
header('Access-Control-Allow-Origin: *');
header("Access-Control-Expose-Headers: Content-Disposition");
header('Access-Control-Origin: xxx.hoo.com');
die('header test');
ubuntu:~/php$ jobs
[1]+ Running php-7.4.26/bin/php -S localhost:8000 -t . 2> /dev/null &
ubuntu:~/php$ curl -I http://localhost:8000/gh7777.php
HTTP/1.1 200 OK
Host: localhost:8000
Date: Wed, 15 Dec 2021 04:30:17 GMT
Connection: close
X-Powered-By: PHP/7.4.26
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Content-Disposition
Access-Control-Origin: xxx.hoo.com
Content-type: text/html; charset=UTF-8
Your 7.4.3 is old. Try again with a more recent version.
If not then include the php CLI command you used and, as the bug template said, the actual outputs of what you saw running curl.
No feedback was provided. The issue is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so. Thank you.