I'm getting the error: "registerServiceWorker.js:71 Error during service worker registration: DOMException: Only secure origins are allowed (see: https://www.chromium.org/Home/chromium-security/prefer-secure-origins-for-powerful-new-features)." This is on the console of a React JS web app.
I understand that to resolve this error I would need to setup HTTPS on my API server, the problem is that I am running this app on the local network and it is served through a local IP address. This web app also uses data that is only exposed locally so I can not host it externally and get an SSL cert for a domain.
From what I've read on StackOverflow I could create a self-signed certificate but this would show users an SSL error page on most browsers.
What would be the best option to resolve this issue?
Related
I am using Expo SDK Version: 36 to generate a PWA.
curl http://$LOCAL_IP:19006/expo-service-worker.js: OK 200
curl http://localhost:19006/expo-service-worker.js: FAIL => Instead of serving expo-service-worker.js it serve the static asset index.html.
It cause the following error in the console:
Failed to register service-worker DOMException: Failed to register a ServiceWorker for scope ('http://localhost:19006/') with script ('http://localhost:19006/expo-service-worker.js'): The script has an unsupported MIME type ('text/html').
The file expo-service-worker.js is not served and this is problematic when you must implement web push notification because only localhost can work without it when site is not served with HTTPS.
Related issues:
https://github.com/expo/expo-cli/issues/2063
https://github.com/expo/expo-cli/issues/2468
How can I fix it?
I have used websocket: https://github.com/kishor10d/CodeIgniter-Ratchet-Websocket
I have implemented websocket on a site. It is working great on localhost but when I uploaded files, it doesn't work. First there was confusion regarding the port I am using which is 2000. Now after contacting Inmotion's support they told me that 2000 is live and there are no firewall issues.
But I get this error when I reload the page:
WebSocket connection to 'ws://127.0.0.1:2000/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
According to their support there is no service listing to this port.
I have used CodeIgniter, Javascript
If you're calling the localhost (127.0.0.1) from the client app, you're calling your own computer, once you have the backend running on a remote server, you have to use the server's domain name or IP address - I'd suppose your web/server hosting service (Inmotion) assigned you the latter.
I know this error is common when using local files, like C:// or files://, but the thing is, Im running my app on localhost, through http-server package.
mongoose.connect('mongodb://myuser:mypswd#ds225608.mlab.com:25608/todo-list-db')
When running the application on the browser I saw this error in the console.
I have dockerized my application and using nginx proxy for https.
I know it is asking me to open the ports 53703, but I am not getting where to open the ports in aws or in docker run command? I am also using it through aws.
Mixed Content: The page at 'https://xuz.xyz.com/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://xuz.xyz.com:53703/'. This request has been blocked; this endpoint must be available over WSS.
Uncaught DOMException: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.
at Object.openConnection (https://xuz.xyz.com/__ion-dev-server/ion-dev.js?v=2.0.2:101:19)
at Object.start (https://xuz.xyz.com/__ion-dev-server/ion-dev.js?v=2.0.2:18:10)
at https://xuz.xyz.com/__ion-dev-server/ion-dev.js?v=2.0.2:465:16
Note: I know the shield icon, but don't want to allow the insecure scripts.
I'm developing an AngularJS web app and I'm testing by running the app locally, e.g. it's not on a server. I keep running into the following error:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at (Reason: CORS header 'Access-Control-Allow-Origin' missing).1 (unknown)
My SO research tells me this is an error on the server side, but I have been successful getting data back from my iOS app running in the simulator and have used Postman with success.
Per suggestion, I'm running the app through http-server. Same issue.
I added a simple test case with the same results:
$http.get("http://www.yahoo.com")
.then(function (response) {
alert("Search Results: " + response);
}, function(error) {
alert("Could not get to Yahoo");
});
This is totally baffling.
Based on this comment:
I'm developing an AngularJS web app and I'm testing by running the app locally, e.g. it's not on a server
Then the reason this is not working is obvious: You cannot make asynchronous calls to servers in Javascript with most modern browsers by default if you are not running the javascript from a webserver (http:// instead of file:///). This is a security measure that is built into virtually all browsers. You could possibly get around this by launching the browser with certain flags; for example with Chrome you could run from the command line chrome --allow-file-access-from-files file:///[PATH_TO_FILE]
However it's recommended that you just run the javascript from a web server. This is extremely simple to do, you could use the node package http-server or Python's SimpleHTTPServer to serve the files up right from the directory they are in.