Grunt hostname 0.0.0.0 access is denied - javascript

I'm wanting to view my SPA on a few different devices on my network, so in my Grunt file I changed the hostname to '0.0.0.0' as Grunt instructs, my connect task/object now looks like this:
// The actual grunt server settings
connect: {
options: {
port: 9000,
// Change this to '0.0.0.0' to access the server from outside.
hostname: '0.0.0.0',
livereload: 35729
},
Now when I run grunt serve the app opens the browser at http://0.0.0.0:9000/ however my application isn't shown, I am given the following Error:
ERROR
The requested URL could not be retrieved
The following error was encountered while trying to retrieve the URL: "http://0.0.0.0:9000/"
Access Denied.
Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect.
Does anyone have any ideas on what I should do to fix this issue. I have tried using hostname: '*' but that doesn't do anything but how the same error.
I am developing on OS X 10.9.2
Thanks in advance

Setting hostname to '0.0.0.0' is correct. You can connect to your server by connecting to http://localhost:9000. Alternatively, you can use the output of hostname to connect with the machine. Optionally, you should also set the baseUrl variable in your tests to connect to

I have the same problem. It seems that the '0.0.0.0' setting allows you to call your site from outside your computer; but screws the call to the web browser asking it to load a page located in an invalid server "http: / / 0.0.0.0"
If you replace the address to the right server name instead of 0.0.0.0 it will work.

You can set your own ip address instead of the 0.0.0.0.
With this grunt launch the server on your ip. You can use your mobile to.
The livereload will work on your desktop and on your mobile.
It's not the best way if your work by team because each one have his ip address but it's good enough if you work alone.

Related

Webpack log errors "net::ERR_SSL_PROTOCOL_ERROR" by calling sockjs-node/info

on front I use react on back .net core 3.1
on client I use webpack that is runned on localhost:8080
in Startup.cs I use proxyToSpa
applicationBuilder.UseSpa(spa =>
{
spa.UseProxyToSpaDevelopmentServer("http://localhost:8080/");
});
on HTTP works as expected without any errors but on HTTPS I saw a lot of console errors and failed requests in Network there is failed requests for (sockjs-node/info?t=...) with error net::ERR_SSL_PROTOCOL_ERROR
Is there any options to configure webpack or .net core project to avoid these error logs on HTTPS?
This might be the issue, it worked for me
https://howchoo.com/chrome/stop-chrome-from-automatically-redirecting-https
If you ever visited the https version of a website (whether it resolved or not), Google Chrome might repeatedly send you to that version
https://webpack.js.org/configuration/dev-server/#devserverdisablehostcheck
using cli
webpack-dev-server --disable-host-check
or in webpack config
devServer: {
disableHostCheck: true
}
My main site was using https (reverse proxy to development server), so definining public: http://... didn't help for my development server, because the browser forced https (as the main site was https to).
What helped me was using https in the devServer too:
https://stackoverflow.com/a/29772748/3279070
It was important that devServer HTTPS was signed with a good certificate like the main site was (the reverse proxy) and uses a hostname (public property) signed by the cert. So for example typical scenario is using the same certificate files and the same hostname (public: 'https://hostname:8081') as the main site

How to update React localhost (127.0.0.1:3000) to another domain (local.example.com)

I am setting up a Localhost domain so it can communicate with this third-party API and Auth servers.
For example, change 127.0.0.1 to local.example.com
local.example.com is the domain whitelisted with this third-party enterprise. I need to set this up so i can run API routes to it.
I was able to change 127.0.0.1 locally in C:\Windows\System32\drivers\etc\hosts file and now Node.js is running on it.
I added the webpack config devServer - host to local.example.com but the port is still there. I need to understand how to change this for react because right now it's porting to local.example.com:3000.
A little late to the party but it still might be useful.
Go to C:\Windows\System32\drivers\etc\hosts and add this line:
127.0.0.1 local.example.com
In the React project, add a .env file with:
HOST=local.example.com
PORT=3006
I think you're almost there :-) The devServer option has a port property. Set that to 8080 or 80. Restart your server. Then, open the browser and try leaving it off the URL
After digging around, I found some solutions. Essential, my goal was to set http://localhost:3000 to http://local.example.com.
1. Add local.example.com to your hosts file (windows)
2. Set up your react port to 80
This would remove the 3000 on local.example.com:3000 to local.example.com
On HTTPS request, set the port to 443
This would result to https://local.example.com

WebSocket connection failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

I am new to WebRTC and WebSockets and was following this tutorial to create a WebRTC demo project, but I am unable to create a WebSocket connection. I have followed the same steps as mentioned in the project.
His project is running on port 8080 and he mentioned ws://localhost:9090. My project is running on port 8081, but I copied his URL ws://localhost:9090 because I didn't know the significance of 9090 and I received this error and my server is node.js. i changed local host to 8081 as well but then i am getting hand shake error.
WebSocket connection to 'ws://localhost:9090/' failed: Error in
connection establishment: net::ERR_CONNECTION_REFUSED.
Chrome doesn't allow unsecure websocket (ws) connections to localhost (only wss, so you should setup a TLS certificate for your local web/websocket server).
However the same should work fine with Firefox.
You need to use ws://yourIp:9090/, where yourIP is like 192.168.?.?.
Usually WebRTC requires a secure connection (that is https).
The error you have got is due to TLS/SSL certificates occupied, may be they are not properly configured in your project.
Provide a valid TLS/SSL certificate and also configure it correctly in project, then it will work without the above error.
try to change the port to 8080
const ws = new WebSocket('ws://localhost:8080/chat')
I guess this is a generic websocket issue.
Change the url to a dynamic name using the built-in location.host variable and change the protocol to secure websocket wss if you have set-up the TLS:
const ws = new WebSocket("wss://" + location.host + "/")
Port 9090 is used by reactotron. Probably you are using it in your project and your app cannot connect with reactotron because it is closed. Just open reactotron and the error will disappear.
also you could easily change the mappings of IP addresses to host names,
on windows go to C:\Windows\System32\drivers\etc\hosts and uncomment this line
127.0.0.1 localhost
save and restart.
WebSocket connection to 'ws://localhost:8080/' failed
Must ensure server file is running
I git this above problem
maybe you forgot to start websocket server, check it again, with configuration in my project, run:
php artisan websocket:init

Make sails.js listen for remote connections

I want my development environment to be accessible from remote connections as well as local. I have changed my local.js config file to listen on port 80 and host 0.0.0.0.
netstat -ab | more output:
Port forwarding:
And my firewall is disabled. however, the app is not accessible via browser and remote IP, nor can it be seen by http://canyouseeme.org.
All the command prompt windows are run with lifted privileges.
I currently don't have the option to run it as --prod if that would change anything.
EDIT: Tried fixing problems with production environment, and running as --prod, still same problem. Also tried setting up the simplest possible node.js server, and it also had this same problem, which leads me to believe, that it's problems with my router, and not sails.js. Any ideas, what could be preventing this?
Let's make your app listen on another port (for example 1337) then forward traffic from port 80 to port 1337.
Another way, you can use Nginx in front as a reverse proxy. By this way, Nginx will handle traffic on any port (80 as your requirement) and forward to your Sails app.
Hope this helped!

Setting for open application(consist of Node.js and Redis) to the public

There are some problems about Scrumblr(GPL Web Application).
Scrumblr consist of Node.js and Redis.
This is Github url : https://github.com/aliasaria/scrumblr .
I run "scrumblr" at localhost:8080 on Ubuntu 11.10.
I configured global IP address on my Ubuntu.
However, I can't access Scrumblr when I accessed "http://global IP address:8080/".
(Error message: Can't establish a connection to the server )
How should I modify scrumblr's source code?
So, please tell me place(directory, file)where I should modify to access Scrumblr via "http://global IP address:8080/".
What I usually do is open up the port 8080 in my firewall so I CAN access it externally, then server the app with localhost:8080 -- sometimes you may have to bind that to an ip, but I'm not sure. I use express which basically takes care of that for me.
Then I edit my /etc/hosts file and map foo.myapp to my public ip address...then I can browse to http://foo.myapp:8080 from anywhere.

Categories

Resources