option for responding to browser cors pre-flight OPTIONS requests

1,232 views
Skip to first unread message

robertob

unread,
Feb 21, 2016, 1:55:38 AM2/21/16
to Fiddler
Does fiddler have ability to respond to browser cors pre-flight OPTIONS requests in case of rest endpoints that don't have that functionality in place?

I ask because i'm working with visual studio 2015 update 2 apache cordova tools update 5 typescript based project environment that provides use of chrome hosted ripple emulator for f5 debug/test work. 

In the case of an actual apache cordova app host, e.g. android, ios, windows winrt/uwp, their is no cors pre-flighting that happens but when debugging with ripple emulator chrome does what browser will do when an xhr / http provider request is issued against any rest endpoint.

I was referred to this chrome extension https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?utm_source=chrome-app-launcher-info-dialog but it appears to only address changing the 'Access-Control-Allow-Origin: <urls>' header response to 'Access-Control-Allow-Origin: *' which assumes the rest endpoint is enabled to respond to cors pre-flight OPTION requests in the 1st place.

robertob

unread,
Feb 21, 2016, 1:58:34 AM2/21/16
to Fiddler
it looks like this prior post https://groups.google.com/forum/#!searchin/httpfiddler/fiddler$20cors$20response/httpfiddler/D8Cxm4dfhkY/oFi6QGnOIWAJ asks the same thing but its not clear there was a solution for that when it was posted.

EricLaw

unread,
Feb 21, 2016, 9:03:16 PM2/21/16
to Fiddler
Yes, Fiddler offers multiple ways of handling this; the post you cited includes the simplest way (via the AutoResponder); I'm not sure what you mean when you say "not clear there was a solution."?

Action *CORSPreflightAllow 
Use with a Match Condition like: METHOD:OPTIONS example.com

Respond to a Cross-Origin-Resource-Sharing (CORS) preflight request, granting the client permission to access the target resource. 

robertob

unread,
Feb 21, 2016, 9:59:51 PM2/21/16
to Fiddler
Iwas confused by fact that i'd only ever previously used fiddler | rules | customize rules | onBeforeRequest style entries and was completely missing the details view | AutoResponder tab that was being referred to here.

So i visited fiddler | details view | AutoResponder tab and added rule with 1st rule editor field set to "METHOD:OPTIONS mydomainwithNonCoresEnabledRestEndpoints.com" and 2nd rule editor field set to *CORSPreflightAllow and saved that.  I also checked the "Enable Rules" and "Unmatched requests passthrough" boxes.

Afterwards fiddler took care of automatically responding to cors pre-flight OPTIONS request sent out by chrome instance operating cordova app ripple emulator and all was good with non-OPTIONS requests that followed.  

Sweet feature, thanks.
Reply all
Reply to author
Forward
0 new messages