In my website has many JS files and I want if a particular JS is loaded in the browser then rewrite will call a servlet in another domain.
For this I have added following lines :
<VirtualHost *:80>
ServerName mydomain.com
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/someresource.js
RewriteRule ^/someresource.js http://anotherdomain.com/bin/test/custom [R=301,L]
</VirtualHost>
When I see the output in the browser console, it says that Http Method OPTIONS was executed instead of GET call. As a result I am not getting the desired output which is supposed to execute in this call http://anotherdomain.com/bin/test/custom
The servlet(/bin/test/custom) has only doGet method.
If I hit this url directly in the browser mydomain.com/someresource.js then redirect works correctly. But it does not work when the browser loads someresource.js
What am I doing wrong?