How to enable CORS in Qt Webkit (QWebView)?
I get an error in debugger when trying to show some page. This is error "XMLHttpRequest cannot load http://... . Origin http://localhost is not allowed by Access-Control-Allow-Origin". I tried to add this flag page()->settings()->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, true) but it seems it's doesn't work. Can you give me any suggestion?
You need to setup your server correctly to support CORS
[quote author="SGaist" date="1425340802"]Hi,
You need to setup your server correctly to support CORS[/quote]
Thank you for reply! But unfortunately it's not work. I tried to make some changes in config of lighttpd "setenv.add-response-header = ( "Access-Control-Allow-Origin" => "*" )" but nothing changes.
As additional info: this interface work in chrome with enabled addon named "Allow-Control-Allow-Origin". I have interface on my apache, code of interface made request to another domain and it works with enabled cors (and i have same error as in first message when it turned off)
You're welcome !
Did you take a look at "that":http://doc.qt.io/qt-5/qwebsecurityorigin.html#addAccessWhitelistEntry ?