How can I enable my laptop to receive HTTP requests over port 8080 on my private network? - web-services

I'm behind a router and I have a web service hosted on Tomcat on my laptop. It's running on port 8080. I want my phone, also connected to my home network to be able to send HTTP requests to my laptop on port 8080. I installed a REST service app on my phone that allows me to send customized HTTP requests to wherever, and I tried sending it to 192.168.1.20:8080/web-service/test, where 192.168.1.20 is the address of my laptop on my home network and /web-service/test is the url I'm using to interact with the web-service, but I keep getting an "invalid request" message. When I access the web-service through that url using localhost:8080/web-service/test on my laptop the text that's printed in the browser is "running," but not when accessed through the phone.
I also tried pinging my laptop from my phone using another app and the ping is successful. The firewall is turned off and network sharing is on (windows 10). Anyone have any idea why I cannot access the web-service using 192.168.1.20:8080/web-service/test?

the problem was with the rest api testing app i was using on my phone. for some reason it was showing me an "invalid request" message even if the same url worked when i visited it from the chrome app. but basically it was working the entire time.

Related

communication between web host server and home server

I have a web application hosted on an external server. I would create a communication beetwen my home server and the web application.
I thought something like that:
my home server send its ip to the web application
the web application send data to the home server
my home server send back some data
I want to implemente a P2P communication between the WebApp and the home server
it would be bettere if the communication is encrypted
i dont want to use dynamic dns
Is there something to implement that?
There are several types of IP. It can be "grey" and "white".
"Grey" means that your computer can't be accesses through it.
"White" IP's can be accessed directly. Also there are dynamic IP's
that changes through the time. It all depends from the provider.
It's possible that you have "white dynamic" IP but it's pretty rare
for providers to do.
It's easier to connect to server because it
always have "white" permament IP.
TCP/IP already does most of the work. You just create tcp connection and it stays. You just think about sending data.
My suggestion for you is to create something like this:
Home server connects to WebApp
Home server requests some data and WebApp sends back data
Home server sends request containing data and server respondes that all is ok
So you have client-server model. And client always does only requests and server does only responses. And they do not switch. It's easier to maintain.
There is common technology of doing that and it includes encryption too.
You should use HTTPS protocol. Https will do all the encryption(and safely exchange keys too) you just worry about certificates(there are ways not to buy certificate but sign them by yourself. It's whole another topic)
So you will send https requests from your home server PC(client) and get responses from server(webApp).
As you write on Python you would find this answer helpful for you:
HTTPS request in Python

Port blocked creating web app on AWS

I'm trying to create a web app on AWS and I'm running into port issues. I would like to have multiple apps providing different services on different ports. I've created a website (on the same instance) to receive a text query and pass it to my app on port 3000. The app listening on 3000 is written in CherryPy.
We are using a VPN to provide security for the AWS instance. When logged into the VPN, everything works fine. The web page loads, the query returns the correct data. When I disconnect from the VPN, or someone else goes to the page, the page still loads, but queries to the service time out.
I've used netstat to make sure the service is listening but I'm not sure what could be blocking traffic. I've worked through the CORS issues as evident by the fact it works when I'm signed into the VPN.
What can I check now?
When I disconnect from the VPN, or someone else goes to the page, the page still loads, but queries to the service time out.
My assumption is that the web server and the app are on the same server.
It sounds very much like the connection from web server to app is happening via a routed IP address rather than localhost. In addition to being slower, it's also hitting your firewall rules.
Configure the web server to access your app on localhost:3000 and the issue should clear up.
I actually got it working. I have an AWS instance with nginix and CherryPy. When the user goes to a web address, the nginix page loads with a form for a query string. When they submit a string, the string is POSTed to a CherryPy service running on port 3000. The CherryPy service does some computations and returns a result via JSON.
I thought I had opened up everything completely for testing, but I was having so many issues. It turned out that having CherryPy set
"Access-Control-Allow-Origin" = "*"
wasn't working, instead I needed to specifically set the origin of the calling page.

Access virtual machine from remote server

In my work we use VirtualBox for development so sometimes it gets a little bit tricky when it comes to testing.
Actually I'm working on a payment platform and I have to integrate with PayPal Instant Payment Notifications.
The idea is that when a Paypal transaction is approved, PayPal sends an IPN message to my server and that is the problem.
Is there a way I can make my local development server available so PayPal can access it?
Thanks in advance.
I assume your server is running inside the VirtualBox, right?
So you will have to give the VirtualBox machine an IP that your company router can relay the PayPal IPN message to. That IP should also be a static IP (not by DHCP) so the routing on the router could be set accordingly.
(The following works well, I have done it successfully numerous times)
To do that:
Setup the VirtualBox to have the IP from the company router: In VirtualBox adapter go to the 'settings' of that said VirtualBox, click on 'Network' and change 'Attached to' to 'Bridge Adapter'.
Launch the VirtualBox and change the IP of the machine to a static IP allowed by the company router.
Create on the company's router a routing ('Virtual Server') from a specific socket to this static IP. For example, for socket 1234: http://YourDomain.com:1234
Then you give the PayPal server this domain with socket. any communication on this socket would be routed directly to your server inside the VirtualBox.
Hope that helps!

CFHTTP firewall issue? How are CFHTTP requests made?

CFHTTP on my new CF 9 server is failing. I get back "408 Request Time-out" when attempting to connect to the test page on the server via its internal or external IP. I am not using SSL and using the standard port 80.
My old CF 9 server can connect to itself fine but it also fails if attempting to connect to the new server.
If I RDP into the server, I am able to pull up the same test page via a web browser or via telnet to that ip port 80.
I suspect that this is a firewall issue. I'd like to know how CF makes an HTTP request under the hood before I talk to the hosting team. What service is making the call? What port is it running under, etc.
You don't say what operating system you are running under, but if it is Windows, I'd take a look at the Windows Firewall settings on your new machine, and disable the firewall. That will allow you to check if indeed it is the Firewall in the way.
If that works you can then try and add a firewall exception for the application, i.e. JRun.
Hope that helps.

WebService timeout

I have a problem with deploying my web service in our Web server. In my
development machine (inside of our LAN), everything works fine. When I move
the application into our Web server (public addressed), I always get the
timeout exception. while i connecting the web service through my web browser it works fine with no issues, but through application am getting the timeout error. My app connects to our database server (inside of our LAN) to get statistical data in form of datasets. can i know the issue about this point.
That is most likely a firewall/port forwarding issue.
Did I understand you correctly: Your client application connects to the database server directly?
You should check which port you are using to connect to the database server.
Then check if the web server has an active firewall and if so, configure it properly to accept connections on that port.
You can always easily check if a port is open and reachable by using telnet:
On the command line type telnet MY_IP MY_PORT.
If a connection can be established the port is open.