CORS (Cross-Origin Resource Sharing)
Status : Draft
Lihat 20 s.d 22 di http://workshop.openthinklabs.com/resources/mobile-development/ionic-framework-bootcamp/referensi.
Jangan lupa aktifkan module headers.
sudo a2enmod headers
Universal .htaccess CORS Support
Berikut contoh .htaccess untuk Silex, masih belum terlalu paham dengan regex dan .htaccess secara mendalam, jadi kemungkinan besar ada yg kurang pas disini, tapi setidaknya, ketika di tes menggunakan posman dan langsung di ionic versi web, dapat berjalan
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteBase /
# with AJAX withCredentials=true (cookies sent, SSL allowed...)
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"
RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L,E=HTTP_ORIGIN:%{HTTP:ORIGIN}]
#dari sf
# we skip all files with .something
RewriteCond %{REQUEST_URI} \..+$
RewriteCond %{REQUEST_URI} !\.html$
RewriteRule .* - [L]
# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
# no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
....