0

Cloudflareの背後にあるApacheプロキシを使用しています

これがシナリオです

世界 -> Cloudflare Https -> Apache -> PHP

世界 -> Cloudflare Https -> Apache/Proxy -> NodeJS

私のApacheでは、この構成を入れました

<VirtualHost *:443>
            ServerAdmin webmaster@localhost
            ServerName  mydomain.com
            ServerAlias www.mydomain.com
            DocumentRoot /var/www/mydomain
            RewriteEngine On
           
            Header set Access-Control-Allow-Origin "*"
            Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
            Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"
            <Directory /var/www/mydomain>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride All
                    Order allow,deny
                    allow from all
                    Header set Access-Control-Allow-Origin "*"
                    Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
                    Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"

            </Directory>
        

            LogLevel debug


            ErrorLog ${APACHE_LOG_DIR}/mydomain-error.log
            CustomLog ${APACHE_LOG_DIR}/mydomain-access.log combined
            SSLEngine on
            SSLCertificateFile /var/www/ssl/crt/mydomain/primary.crt
            SSLCertificateKeyFile /var/www/ssl/crt/mydomain/private.key
</VirtualHost>

しかし、任意のドメインから API を呼び出すと、chrome と firefox の cors で常にエラーが返されます

リファラー ポリシー: strict-origin-when-cross-origin

4

1 に答える 1