I am writing to ask what is causing the behavior of my NodeJS application. So, I am wanting to allow access to external connections to the server while running the application off of my computer.
NodeJS app.js
server.listen(3000, 'device-IPv4 address');
Then I am port forwarding off of my router on port 3000 just fine.
So when I access the server via http://device-IPv4:3000, things work perfectly fine as expected.
But when I access the server via http://PublicIP:3000, it technically loads, however, it often stalls by waiting for a connection giving the error:
"This site can't be reached. ERR_CONNECTION_TIMED_OUT."
But if it tries to connect enough times, it eventually loads seemingly randomly.
I would think that this set up would work just fine, so I cannot figure what would be causing that sort of behavior. What all could it be? If you need more info, just ask, and I can provide. Thank you for the help.
Related
I have a project with the following problem:
If the page is accessed directly via the domain, you can switch to any subpage without an error. However, if a URL is called directly, e.g. https://impalawolfmitbiss.com/consulting, a server error is issued. This actually affects every subpage that is not called from the main page.
Error Logs:
Apache server logs (500 GET /consulting HTTP/1.1)
Chrome Console Network: 500 Internal Server Error
Since I rarely have to deal with such applications, I just want to ask in advance if this is a known problem and if anyone has any suggestions for a quick solution or Tips i can search.
a note: if I start the application locally, the problem does not occur.
Site: https://impalawolfmitbiss.com
I'm making a app with the Electron Framework, within this the user needs to register an account to be able to use this app.
This worked great when making this for my localhost database, but creating connection with the MySQL server that is running on a dedicated server seems not working for me, and also insecure since people can unpack the .asar file and see the database credentials..
So, I've heard about 'SSH Connection' but can't figure out how to set this up, and get this up and running for my Electron app.
I am using XAMPP to create a MySQL/Apache server and I use HeidiSQL to enter the MySQL server.
For your info, I've never used Electron before and this is my first time using it. I've also never used a SSH connection before (at least, not that I'm aware of.) so a guide for newbies would be nice.
I have a site that is running in Node and using express for the server. I also have an API on a different server I need to hit. Everything works fine except in IE9. The issue is when ever i try to hit my API once i have the page loaded it breaks.
For example on the home page i have a search form where each step makes an API fetch and once I try to make my first fetch i get this error
"Unhanded promise rejectionError: Access Denied"
It seems like it has to do with a CORS issue since IE9 didnt have CORS and the era of the error message. Also when I make the fetched server side I have no issue, its just when the client tries to perform them.
Has anyone had an issue like this and if so how did you fix it?
Currently I am trying this but it hasnt worked yet:
First I changed my api host address to the current sites address with /api at the end.
apiHost: process.env.API_HOST || 'http://127.0.0.1:3000/api'
Then in my express server is run this:
app.use(modRewrite([`^/api/(.*)$ http://api.mysite.dev:8080/$1 [P]`]));
I was hoping to avoid making a fetch cross address with this but no luck as of yet.
Any help would be much appreciated
thanks!
To solve this problem I changed my host file for my machine to use mysite.dev for the 127.0.0.1 IP. Then went to mysite.dev rather than 127.0.0.1 when testing my site. Then did what I did above to get it to work
I am listening for HTTP requests to localhost on a specified port using chrome.sockets.tcpServer running in a Chrome App. I'm basing my app on the code samples from Google:
https://developer.chrome.com/apps/app_network#tcpServer.
The HTTP requests are coming from a single instance of a Flash application. It starts off working okay. When the first request comes through, the Chrome app makes a connection with a client socket, and seems to use this connection for subsequent requests.
Sooner or later though in the same session, Chrome will open another client socket for a given request, then will quickly throw a chrome.sockets.tcp.onReceiveError for the new client socket. Then the original socket will also throw the same error, and no sockets remain connected.
The Flash code is just making a regular HTTP request (it's not specifically asking for a new port).
Does anyone know:
what do I need to do to keep all requests on the same client socket id?
or how do I get the server to cope with changing sockets?
I've put the server code here if anyone has time to take a look:
https://github.com/tarling/http-test/tree/flash/js
I wondered if it was something to do with "Connection: keep-alive" so have included this in the HTTP response header
https://github.com/tarling/http-test/blob/flash/js/http.js#L52
Thanks for any insight
I think I've fixed it. Updated code is on GitHub
Changes were:
recognising a result code of -100 from chrome.sockets.tcp.onReceiveError as a disconnection, and so disconnecting and closing the client socket. This was after looking at this code
remembering the lclient socket ID from the last successful chrome.sockets.tcp.onReceiveError call for subsequent sends
only needing to register listeners for the onReceive and onReceiveError events once.
I have created nodeJS io.socket chat app using the link here -
http://cestfait.ch/content/chat-webapp-nodejs
I am able to run it on my laptop. I did not find any help on google how to connect to nodeJS app from other machines. I have another laptop which I have connected through wifi.
Now I really want to know how can I connect another user from another laptop to the nodeJS server running on my first laptop.
I will be very grateful for your help. Any help in broader sense will also be ok.
EDIT 1:
When I am trying Brandon's method, I am getting following error. Not sure what is wrong. I have to run the file client.html directly in the browser. Running http://192.168.43.244:8000/client.html throws the error.
C:\node>node server.js
info - socket.io started
C:\node\node_modules\socket.io\lib\manager.js:0
(function (exports, require, module, __filename, __dirname) { /*!
^
RangeError: Maximum call stack size exceeded
It's complicated.
If you don't have a static IP address (and you probably don't) that means every time you reconnect your computer to the internet, you are going to get a new IP address, so you'd have to update your code every time.
Also, there are issues with Firewalls, both on your dev machine and with (wifi) routers.
Best solution is to acquire a static IP. But its not cheap
First, make sure Socket.IO is connecting to the server serving the HTML. In client.html, change:
var socket = io.connect('http://localhost:8000');
to
var socket = io.connect();
Leaving out the host/port will cause Socket.IO to connect to the same host and port serving the HTML.
Once you've done that, you can access the server from another computer by visiting http://1.2.3.4:8000, where 1.2.3.4 is the IP address of the computer running the server. The connecting computer and the serving computer will need to be on the same network for this to work; if you want to (temporarily) connect with someone on a different network, you can use a tool like localtunnel.