Send HTTP POST to API server running on localhost from another PC - http

My web server is running on localhost (127.0.0.1:8800) and I would like to send HTTP posts from another machine to that server.
Does anyone know how I will be able to access the server from the outside? (I did a SSL port forwarding from the external address to localhost, but it is a kind of hack and some aspects do not working properly, e.g. web socket does not detect traffic that's been forwarded)

127.0.0.1 is the loopback address of your network card. Only your computer can access that. 127.0.0.1 on any other computer will be that other computer.
You will have to run your server on your internal ip-address (if you're doing this in an internal network). It will probably look something like 192.168.0.x. If you're instead connecting to the computer using the internet you will of course have to bind the server to the external ip-address.
You can find your internal ip-address on Windows by opening cmd.exe and typing ipconfig. On OSX or Linux/BSD you run ifconfig in a terminal.

Related

Accessing a local website from another computer inside the local network in IIS 10

On my computer I have deployed my web site on IIS. If I access this website locally with :8080 works perfect, but when I try to access this site from another machine or my Android phone I get 'The site can't be reached. my_ip_address took too long to respond ERR_CONNECTION_TIMED_OUT –' this error.
I have tried solutions from this question, but nothing worked for me. Need some help!
There are few factors which can affect the accessibility of the site hosted on your local computer:
Is the client machine (including your phone) in the same network as the Server (In this case your site)
Is the firewall configured to allow connections on port 8080
Have you tried accessing the server using the IP Address. For e.g. http://192.168.0.1:port
Steps to isolate
Ping the server Ip from the client machine and see if it is able to connect to it.
ping 192.168.0.1
If the above fails, then I would assume that you are not on the same network. If it succeeds then check if the port is open.
You can also use nmap to see whether the ports are open or not
nmap -p 8080 kaushal.com
If the above fails, then open the port in your Firewall configuration and then try again.
Try this and share the results.

Access server in local network through domain

i have problem with access to server with domains.
Test url: testpage.example.com.
Server is in local network with port fowarding (80, 443), configured as web server using caddy server as reverse proxy.
Case 1 (using Asus router):
Connected on local network behind router. Server is in the same network as my computer. Everything works like a charm in and out of my network.
Case 2 (using internet provider router):
Connected on local network behind router. Can't access server with domain. Works with direct IP. Outside network, works as in case 1.
I used same server.
Does anyone know why this problem occured? How can i solve it?
Thanks,
David
Two options I can think of:
You could add a record to whatever DNS server you're using in Case 2.
You could write a short script that runs whenever you change network connections to modify your hosts file accordingly.
This happens when the server you are trying to reach "testpage.example.com" resolves to your router's external IP address. Because your public IP address is the same as server's IP address (even though inside your home network you have different private IP addresses) your requests are lost in the ether.
As a workaround you can resolve the testpage.example.com manually on your local machine.
For Windows c:\windows\system32\etc\hosts
For Linux /etc/hosts
testpage.example.com 192.168.1.102 -> private IP of the machine serving the site.

Cannot access chef-server web interface. (No route to host)

I have got chef-server installed on a centos machine.
Everything is working as expected except that I cannot access the chef-server web interface from another machine on my local network.
I can access the web interface from the centos machine itself:
telnet mychefserver.local 4000
Connected
If I do the same from my machine I have got:
telnet: Unable to connect to remote host: No route to host
I can successfully ping mychefserver.local from my machine
Any idea how to configure nginx with chef-server to access the chef-server from the network?
Since Chef Server 10, the web interface uses normal HTTPS (TCP 443), it only listens on the high ports locally, and nginx proxies as needed to the different backend services. I would try with a normal web browser as telnet isn't exactly great at error messages. Normally I would expect that to mean telnet is getting TCP transmission errors, but maybe it is just confused? If it is really a TCP transmit error then more likely the internal DNS is having issues. .local often means mDNS which has uneven support in some places, I would try an actual IP address to be sure.
My issue was iptables.
I stopped iptables and I can access the chef-server from my local network again.

Open website via computer IP address while running tomcat locally with a router?

I'm working on a website for a friend, developing using Eclipse/Tomcat. I'm running it locally and trying to open it via my internet port IP address, but I can't get it to work. The computer I am running it from is connected to a router, so it is running off of 192.168.1.4, and http://192.168.1.4:8080/Mobile_Site/index.jsp works. However when I try and open it via my internet port IP, http://67.xxx.244.xx:8080/Mobile_Site/index.jsp it doesn't find it from any device, even outside my local network. Is there a way to send the link when running locally when connected to a router?
You have to configure your router port forwarding (or virtual servers depending on the router) to forward TCP connections from 67.xxx.244.xx:NNNN to 192.168.1.4:8080.
Then you give the 67.xxx.244.xx:NNNN address to your friend.
Note: NNNN at your router doesn't need to be 8080, as long as the port forwarding is set properly.

Connecting to Windows localhost (IIS) from another computer

I have a Windows Vista laptop running IIS7 for its localhost. On this machine, I can successfully navigate to:
"http://localhost"
"http://127.0.0.1"
"http://mycpuname"
However, I cannot access this localhost website from another computer on the same network. Ideally I would be able to visit "http://mycpuname" (so that I can hard-code a connection), but at this point I might settle for the IP address of the machine (http://192.000.000.xyz)
I've seen similar questions asked here and elsewhere on the internet... but none of the posts seems to fix the issue for me.
Things I've tried:
- adding exceptions to Windows Firewall to allow TCP ports 80 and 8080
- disabling Windows Firewall entirely
- running the "netsh" commands in this post
Additionally, I am looking at the IP address on the Windows laptop by running "ipconfig" from the command prompt. Oddly enough, trying to access "http://192.000.000.xyz" from the Windows laptop doesn't seem to work...
I have also tried restarting IIS and restarting my machine.
Help?
Go to windows firewall with advanced security, inbound rules and check and see if world wide web services is enabled. I had this same issue, and this fixed it for me.
are you binding to 127.0.0.1? run below command
netstat -an |findstr :80 |findstr LISTEN
if it shows 127.0.0.1, you need change IIS listen to 0.0.0.0
Try netstat -na - it will show you what IP addresses your web server is listening on.
If it's only listening on 127.0.0.1, the loopback, you will have to re-configure the web server to listen on all addresses/interfaces (usually either *.*.*.*, or 0.0.0.0 in some config file, or just some drop-down in some windows dialog somewhere).
If, on the other hand, netstat tells you the web server is listening on *.*.*.* or 0.0.0.0, i.e. all interfaces, then you have to figure out what's blocking the traffic - it's either the local firewall, or something on the path between the two computers.
If you want to access your website from any other computer on your local network then you need to simply type your network IP and port. If you want to access it from internet then you need to configure your IP.

Resources