php - apache cross domain configuration -
i trying setup application on server openspeedtest.com self-hosted app provided nginx configuration. how can make work on apache shared hosting server?
fastcgi_read_timeout 360; client_max_body_size 2000m; location / { if ($http_origin) { add_header 'access-control-allow-origin' 'http://openspeedtest.com'; add_header 'access-control-allow-methods' 'get, post, options'; } if ($request_method = options ) { add_header access-control-allow-credentials "true"; add_header 'access-control-allow-headers' 'accept,authorization,cache-control,content-type,dnt,if-modified-since,keep-alive,origin,user-agent,x-mx-reqtoken,x-requested-with'; add_header access-control-allow-origin "http://openspeedtest.com"; add_header access-control-allow-methods "get, post, options"; return 204; } }
add server!
setting cors (cross-origin resource sharing) on apache. create .htacess file config.
# set these headers. header set access-control-allow-origin "http://openspeedtest.com" header set access-control-allow-methods "post, get, options" header set access-control-max-age "1000" header set access-control-allow-headers "x-requested-with, content-type, origin, authorization, accept, client-security-token" # added rewrite respond 200 success on every options request. rewriteengine on rewritecond %{request_method} options rewriterule ^(.*)$ $1 [r=200,l] #don't forget activate apache module headers a2enmod headers
Comments
Post a Comment