Add CORS option
See original GitHub issueWhen using the proxy option and loading browser-sync manually via inline script tag it would be nice to have the possibility to check if the server on port 3000 is running, like this:
var url = '//' + location.hostname + ':3000/browser-sync-client.js',
xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if(xhr.readyState == 4 && xhr.status == 200) {
document.write(('<script async="async" src="' + url + '"><\/script>'));
}
};
xhr.open('HEAD', url, true);
xhr.send();
The problem is that sending the head request is not allowed, because the browser treats the request to the server on port 3000 as a cross-domain request. It would be nice to have an option to configure CORS headers for the browser-sync server.
Issue Analytics
- State:
- Created 9 years ago
- Comments:14 (3 by maintainers)
Top Results From Across the Web
Cross-Origin Resource Sharing (CORS) - MDN Web Docs
Cross-Origin Resource Sharing (CORS) is an HTTP-header based mechanism that allows a server to indicate any origins (domain, scheme, ...
Read more >CORS Enabled - W3C Wiki
Open Internet Information Service (IIS) Manager · Right click the site you want to enable CORS for and go to Properties · Change...
Read more >Express cors middleware
CORS is a node.js package for providing a Connect/Express middleware that can be used to enable CORS with various options.
Read more >Enable Cross-Origin Requests (CORS) in ASP.NET Core
This article shows how to enable CORS in an ASP.NET Core app. ... For more information, see CORS policy options in this document....
Read more >Using CORS in Express - Medium
Enabling CORS The easiest way to get CORS working in Express is by using the cors npm module. That's it. CORS is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@bclinkinbeard @TeodorKolev also, since 2.16.0 this is supported via the
cors
option.@TeodorKolev you need to add this to your BS config: