Skip to content

Allow CORS di Server PHP Apache

Edit apache.conf

shell
<Directory /var/www/html/>
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Allow from All
        Require all granted
</Directory>

<IfModule mod_headers.c>
  Header set Access-Control-Allow-Origin "*"
</IfModule>

Jika nginx kurang lebih seperti ini

shell
location / {
  add_header Access-Control-Allow-Origin *;
}

Enable headers dan rewrite

shell
a2enmod rewrite headers && apache2ctl restart

Referensi

Built with VitePress