Monday, 5 October 2015

Troubleshooting : No 'Access-Control-Allow-Origin'

Pada file .htaccess di aplikasi web (webservices) yang digunakan tambahkan konfigurasi berikut :

SetEnvIfNoCase ORIGIN (.*) ORIGIN=$1
Header always set Access-Control-Allow-Methods "POST, GET, PUT, OPTIONS, PATCH, DELETE"
Header always set Access-Control-Allow-Origin "%{ORIGIN}e"
Header always set Access-Control-Allow-Credentials "true"
Header always set Access-Control-Allow-Headers "X-Accept-Charset,X-Accept,Content-Type"

Referensi


  1. Universal .htaccess CORS Support, http://blog.revolunet.com/blog/2013/10/03/universal-CORS-htaccess/

No comments:

Post a comment