I have a REST web service hosted on tomcat-7 on my local machine. I have an application which uploads a file to the REST service.
Now the problem I am facing is that when I use following URL for POST the uploaded document then the document is getting uploaded successfully.
http://localhost:8080/ResourceNet/upload
However when I replace 'localhost' with the IP of my machine and use following URL
http://192.168.68.193:8080/ResourceNet/upload
then nothing happens. The POST request never reaches to the REST service. However the GET requests are working properly with URL-2.
Kindly help me out on the following points:
Why POST is not working with IP address of the system but working when 'localhost' is used in place of IP.
Why is it that GET is working properly with IP address is URL but POST is not.
Thanks in advance.
One cause might be that the server is bound to localhost and will listen only for requests from localhost, but since you mention GET works it might not be this afteral.
The other thing I will check is the firewall on your PC or network. The fact is that localhost is a loopback address so it does not go into the network when you use it. Using the actual IP of the PC goes on to the network and is routed back to the PC. Maybe a proxy or firewall throws away the POST and only allows GET?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With