mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Enable all origins via CORS header for custom schemes
This PR disables CORS for custom schemes, which allows you to serve Font resources from custom schemes after using registerCustomSchemeAsSecure
This commit is contained in:
@@ -50,6 +50,9 @@ void URLRequestBufferJob::GetResponseInfo(net::HttpResponseInfo* info) {
|
||||
status.append("\0\0", 2);
|
||||
net::HttpResponseHeaders* headers = new net::HttpResponseHeaders(status);
|
||||
|
||||
std::string cors("Access-Control-Allow-Origin: *");
|
||||
headers->AddHeader(cors);
|
||||
|
||||
if (!mime_type_.empty()) {
|
||||
std::string content_type_header(net::HttpRequestHeaders::kContentType);
|
||||
content_type_header.append(": ");
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "net/http/http_status_code.h"
|
||||
#include "net/url_request/url_request_simple_job.h"
|
||||
|
||||
const std::string kCorsHeader("Access-Control-Allow-Origin: *");
|
||||
|
||||
namespace atom {
|
||||
|
||||
class URLRequestBufferJob : public JsAsker<net::URLRequestSimpleJob> {
|
||||
|
||||
@@ -32,6 +32,9 @@ void URLRequestStringJob::GetResponseInfo(net::HttpResponseInfo* info) {
|
||||
std::string status("HTTP/1.1 200 OK");
|
||||
net::HttpResponseHeaders* headers = new net::HttpResponseHeaders(status);
|
||||
|
||||
std::string cors("Access-Control-Allow-Origin: *");
|
||||
headers->AddHeader(cors);
|
||||
|
||||
if (!mime_type_.empty()) {
|
||||
std::string content_type_header(net::HttpRequestHeaders::kContentType);
|
||||
content_type_header.append(": ");
|
||||
|
||||
Reference in New Issue
Block a user