Reading Time: 2 minutesSo I finally got time to jump back onto my personal project for my next startup, and must say I ran into quite the issue. Because my API is setup and deployed on my server, I’m required (because of AJAX) to do OPTIONS requests, which upon success, will follow up with the actual request on success.
But something went wrong.
I thought, maybe I changed a configuration file or there’s some bug. Looked in the application logs, as well as the apache logs. Nothing.
I googled every possible permutation that came to my mind for what mind show me some possible idea as to what in the world was happening. Mind you, all other requests (GET, POST, PUT, DELETE) were all working correctly. But I needed OPTIONS to work for my application. I reviewed all the apache and program configurations.
In total, I spent probably 3-4 hours on this. Did curl requests to only get an error (52) empty response. It finally dawned on me that something had to be interfering with my connection. I wasn’t even getting a response from the server, but since the other responses worked, I knew the server was working.
I finally stumbled upon this information on Ben Nadel’s site: http://www.bennadel.com/blog/2559-cisco-anyconnect-vpn-client-may-block-cors-ajax-options-requests.htm
During the week I installed Cisco AnyConnect so that I could get my company vpn working on my macbook without having to use their laptop, which just slows me down from sometimes doing what I need to do. Uninstalling Cisco AnyConnect completely fixed my issues instantly!!!
I’d never felt so relieved in my life! After losing a better portion of the day, I finally was back in the position to start making headway on my application.
Hope this can help anyone who comes across it.
I’m also adding my list of googled search terms in the event anyone else has the same issue, but hasn’t found the right fix yet:
apache header set access-control-allow-origin “*”
apache Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at
chrome OPTIONS (failed) net::ERR_EMPTY_RESPONSE
cors not working in apache
apache no response from OPTIONS
apache not adding allow-headers
htaccess access control allow origin not working
apache options request failed
apache options request empty response
OPTIONS curl Empty reply from server