why servername:port does not work why localhost:port in node.js works? - node.js

I am node newbie. I have a windows server, where I am running node.js with webserver.js. Start the node with webserver.js. Fireup the IE and when I tried localhost:port/index.html, the page shows properly in the IE. Now if I change the localhost to servername:port/index.html, IE is unable to display the page ('IE cannot display the webpage with you can try diagnose connection problem). Is there anything I need to enable in node so it is available outside localhost? I have jenkins runs on the same server, I did not do anything and it shows up properly with the server name. Just curious.
Thanks

my problem was that, I used the code from the link, in the link it was use IP address, I changed it to server name, now I am able to hit the link using both server and proper url. Hope this might help others. I did not change to use netstat though.

Related

Can I run a web server in a GitHub Codespace?

Part of my development process involves using Mocha and Chai tests. I have a page in my test folder that loads all the code and tests, and I can start up a local node script that runs a simple local server, visit that page on http://localhost:8080/blahblahblah.html, and see the test results.
GitHub recently announced Codespaces and I signed up for the beta. If I start developing in a Codespace, I know there's a terminal there. If I run my testing server in that Codespace, how would I see the test results? Is it even possible to connect to the server in the container from outside? What would replace the URL I show above?
Found the answer here:
https://docs.github.com/en/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace
It's actually pretty surprising. You just have your web server app print a localhost URL to the console, and the Codespace automatically converts that to a clickable URL with the appropriate port-forwarding. Kind of a huge surprise, but also pretty cool.
Just tested and this works.
When an application running inside a codespace outputs a port to the console, Codespaces detects the localhost URL pattern and automatically forwards those ports. You can click on the URL in the terminal to open it in a browser. For example, if an application outputs http://127.0.0.1:3000 or http://localhost:3000 to the console, the log would automatically convert the output to a clickable URL for port 3000.

ngrok does not load NodeJS app from outside (ERR_CONNECTION_TIMED_OUT)

ngrok is a program with which you can make a local tunnel, it generates a temporary domain for you so you can redirect people to your local content, and also use https via localhost.
https://ngrok.com/
localtunnel is just another alternative.
So I have set up either ngrok and a localtunnel but both show a white page with only the HTML loading and not css or js when loaded outside of my network (with data plan for example)
The problem is nothing gives an error, the only thing I can see is ERR_CONNECTION_TIMED_OUT when using a hotspot.
Everything works within my own network.
I have tried turning off the firewall already but it seems to make no difference, also tried looking with the chrome remote debugger but it just disconnects when I load the url.
Thing is when I go to https:// on the ngrok url I get a bunch of mixed content errors, but not when I go to http. Seem illogical to me that it would default to http when using a https link... all of my script/style tags are relative paths.
Anyway so far this is only thing that I can figure out, any ideas on what might cause this?
So it's either
ERR_CONNECTION_TIMED_OUT
or
Blocked loading mixed active content
or both?
So I go it working now by changing the base href.
<base href="http://yoururl.ngrok.io">
And also changing some paths in my config to either /app/ or ../ respectively, but most of these were already set correctly and all I did was revert them after changing the base url.
As far I understand now the problems only really start to occur when connecting to the url through a data plan and not wifi.
Some random image paths in css/js will not load, and it also appears to behave differently on Firefox and Chrome for some reason.
Problem is I cannot keep testing this indefinitely as data will obviously run out some time and I have no reliable way of debugging the console errors on mobile...
In conclusion it works on a "normal" connection now (ie Wifi/Cable) but not on data.

Locally setting up redirect to https://

I have read a few answers to try and find a solution to a ridiculous problem.
I dont have access to a server that I can log on to access phpmyadmin,
What is supposed to happen is that the web url is supposed to be viewed via https, and in most cases this happens.
Except for a particular PC I have at home and it never seems to open in https. Why this is happening on this given machine is completely unknown.
Is there a way I can set up a rule on my local machine that will ALWAYS convert http://pathtomysite.com to https://pathtomysecuresite.com, (possibly via the 'hosts' entry (and yes it is a windows machine running win10).
I could do this on the web server itself, I know how to do this, but the problem is, I don't have, nor am I allowed to have, access to the database server to update the .htaccess or webconfig.xml on the server. (I am 99% sure its Apache, not nginx or IIS).
Any help is allows gratefully received.

Why can't I access my website using the IP address and port number?

I'm having a weird issue with a website I have installed on IIS. I can access it if I go to (ip address)/defaultdoc, but not if I go to (ip address):(port). I'm running a debugger on my browser, and the only thing it's doing when I try to access the site with the port is pulling a 404 error. This is really weird to me because the default document for the site is definitely the page that I go to when I pull up the site otherwise. Does anybody have any ideas why this might be happening?
Edit: I'm suddenly not so sure that the default document is working right. In IIS, it says that the default document is what I want, but when I run a list config command, I get something entirely different.

How to access ccnet page form different computer

ok so i can access the dash board from the server by going to http://localhost/ccnet
what i need to do is to be able to view this page from another computer but typing that url in the browser. if any one knows how to do this please help
thanx
Put instead your localhost the IP address of server where you have ccnet
for example it would look something like this: http://192.168.1.66/ccnet
Of course I typed some default IP you need to check what's yours.
Also check if firewall is not blocking access.
You can use the server name to connect. http://ServerName/ccnet.

Resources