Enable CORS support in Qt + Webkit based application on Windows.
I got CORS (Cross-Origin Resource Sharing) working with Qt 4.7.1 + webkit on server side with appropriate headers as per CORS spec. Essentially, I have need to submit login form HTTP POST to different origin (though same domain) which in turn issues HTTP 302 GET Redirect. I setup my XHR request such that
- It is synchronous call instead of async.
- WithCredentials flag is set to true
- Allow-Access-Control-Origin is set up in Apache to the allow the source origin
- I have allowed various headers and credentials from Apache server side.
While pre-flight request OPTIONS and POST seems to be successful, the webkit's XHR issues status = 0 (error).
Since webkit issues this error, I am wondering if I can enable any settings in Qt so that cross origin is supported inherently without us needing to do steps above. Our application is in a way sand-boxed such that we go to specific domain. It is not open browsing.
If there is no setting like that, workaround is ugly. We have to catch status = 0 and readyState = 4 statuses and consider that XHR is successful and move on to rest of business logic.
Any help would be appreciated.