Posted by: songbard | May 27, 2011

Coaxing apache to honour OPTIONS

Browsers like FF 3.5 sends a ‘preflight’ OPTIONS request first before sending the actual request in GET/POST. Adding the following directives in httpd.conf will send a 200 response code to client browser without actually executing any handler script and then browser seems to send the POST/GET request – to actually execute script with proper parameters.

# enable cross domain access control 
Header always set Access-Control-Allow-Origin "*" 
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS" 
# force apache to return 200 
RewriteEngine On 
RewriteRule .* / [R=200,L] 


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: