CORS OPTIONS Mind Bender

November 22, 2014
Reading Time: 2 minutes

So 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

 

Unable to connect to local XAMPP installation over the LAN

October 29, 2014
Reading Time: 1 minute

I’ve only had this problem on OSX after I recently upgraded to v1.8.3-4 and v1.8.3-5 on OSX Yosemite. It may exist on Linux and Windows, however, it may not.

I could always connect to my local installation over my LAN when it’s running until I 1) Upgraded to OSX Yosemite, and 2) Upgraded XAMPP. Googling the issue returned me 0 results. It wasn’t until I attempted to connect to the XAMPP installation, BEFORE I changed the default document directory in Apache that I was confronted with the area to look for a solution.

In the file: /Applications/XAMPP/xaamppfiles/etc/extra/httpd-xampp.conf – Lines 59 – 65

59 # New XAMPP security concept
60 #
61 #
62 #<LocationMatch “^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))”>
63 # Require local
64 # ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
65 #</LocationMatch>

Comment these out and restart apache. You’ll then be able to remotely connect to the installation.

I’m sure some people may have an issue with this being commented out, but if I care, I can just stop the apache service if I’m on a public network, and/or just uncomment these sections.

My current workflow requires me to cross browser tests from about 5 different OS’ and multiple browsers on each, so I need to have LAN access to my local XAMPP installation.

Hope this helps anyone else wondering what in the world the problem is.