C++ console http api app deployed on Windows Server 2012 is not accessible externally - c++

I am trying to deploy a simple HTTP API app on an Window Server 2012 and it's not working. The app is accessible internally (I can ping it within the server) but NOT externally. What do I need to do make the API server accessible via network? I disabled the firewall so it's not a firewall issue. I would usually use Linux, but I don't have a choice but use Windows this case. Please help!

I solved it by installing IIS and use it as a reverse proxy. So when a http request comes in from the internet, IIS it takes it and forwards it to my web app.. I am not sure this is the right way or not, but if it is, then it's pretty stupid as my web app should be accessible directly which would have been the case if I were using Linux.

Related

[local IP]:[PORT] redirects to public website (Flask, server configuration, local environment)

I want to debug a flask app on mobiles.
My application configuration allows to expose the app to the network:
application.run(host= '0.0.0.0',port=5000,threaded=True)
However, if I load mylocalIP:5000, it redirects to www.example.com, where the production site is hosted, and cannot figure out where it is written to resolve the redirect.
So I cannot see my local environment but in my local machine, and cannot debug the app on other machines - like mobile phones.
Where should I look to solve the problem ?
I must have changed configuration on my machine somewhere, I don't think it is related to flask.
Note: as alternative , I tried use my local host alias:
I'm using a mac, System Preferences > Sharing > Internet Sharing is enabled, other computers in local networks can access my local env at myLocal.local host, but still access to myLocal.local:5000 is forbidden for other machines but my computer.
You can do one thing, install Fiddler app and configure the reverse proxy on your mobile phone. This tutorial will help you to configure fiddler in android applications.
After configuring the reverse proxy, run the flask application on localhost or machine IP and you can access your machine IP on your mobile. Fiddler would also help you to intercept all the calls made to your application. If you don't want to inspect via fiddler you can directly put your mobile on same network of application.

Hosting Back end Application with API on EC2 instance

I'm quite new to AWS and I have been starting to work with EC2 instances. I have a web application that has a frontend and backend separately. So first I hosted the backend application on EC2 instance and it is a Symfony framework based REST API Application. So I have installed all dependencies and now the application is running. But to check the application I ran some API calls to the application using postman and seems application is not working as intended. I get following response from Postman. I have also provided security group configurations properly.
When I start sysmfony app it says [OK] Server listening on http://127.0.0.1:8000.
Can't figure out why this is happening. Can someone help me here?
You are running your application trough CLI (Symfony web server bundle) , by default this will bind to 127.0.0.1 which can't be accessed from outside. To fix this, you must bind to your server's public IP/hostname and port:
php bin/console server:start 192.168.1.1:8000 # replace with your ip
You can also bind to all your IP addresses using 0.0.0.0
But keep in mind, you should not use built in server for production, it's slow and less secure. Use a real web server instead, like Apache or Nginx.

Windows Integrated Authentication fails ONLY if web svcs client is on same machine as IIS server

I have a web service running under IIS7 on a server with a host header set so that it receives requests made to http://myserver1.mydomain.com.
I've set Windows INtegrated Authentication to Enabled and everything else (basic, anonymous, etc) to Disabled.
I'm testing the web service using a powershell script, and it works fine when I run it from my workstation against http://myserver1.mydomain.com
However, when I run the same exact script on the IIS server itself, I get a 401-Unauthorized message.
In addition, I've tried installing the web service on a second server, myserver2.mydomain.com. Again I can call my test script fine from BOTH my workstation and from myserver1.
So it seems the only issue is when the client is on the same box as the web server itself - somehow the windows credentials are not being passed or recognized.
I tried playing with IE settings on myserver1 (checked and unchecked 'Enable Windows Integrated Authentication', and added the URL to Local Sites). That did not seem to have an effect.
When I look at the IIS logs, I see the 401 unauthorized line but very little other information.
I see basically the same behavior when testing with IE (v9) - works from my workstation but not when IE is running on the IIS server.
I found the answer after several hours:
By default, there is something called a LoopbackCheck which will reject windows authentication if the host header used for the site does not match the local host's name. This behavior will only be seen when the client is on the local host. The check is there to defeat possible reflection attacks.
More details here:
http://support.microsoft.com/kb/896861
The kb item discusses ways to disable the Loopback check, but I ended up just switching from using host headers to ports to distinguish the different sites on the IIS server.
Thanks to those who gave assistance.
Try checking the actual credential that is being passed when you are running on the server itself. Often times you will be running on some system account that doesn't have access to the resource in question.
For example, on your box your credentials are running as...
MYDOMAIN\MYNAME
and the server will be something like...
SYSTEM\SYSTEM_ACCOUNT
and so this will fail because 'SYSTEM\SYSTEM_ACCOUNT' doesn't have credentials.
If this is the case, you can fix the problem in one of two ways.
Give 'SYSTEM\SYSTEM_ACCOUNT' access to the resource in question. Most people would avoid this strategy due to security concerns (which is why the account has no access in the first place).
Impersonate, or change the credentials of the client manually to something that does have access to the resource, 'MYDOMAIN\MYNAME' for example. This is what most people would probably go with, including myself.

Testing a remote web service with soapUI

I have a Javax web service deployed in a remote Linux machine within a JBoss ESB container. I am able to test the web service using soapUI on the same machine as where the service is deployed. The WDSL URI I used was something like http://127.0.0.1:8080/abcd/abcd?wsdl.
What I would like to do is to be able to test the same service from another machine using soapUI. I tried replacing 127.0.0.1 with the IP address of the machine where the service is deployed. This does not seem to work. Can someone tell me what I am missing here?
Thanks.
a sum of things could go wrong there - as already mentioned by the others the firewall is blocking access for the given (address, port) pair. Another thing that happened to me was that the WSDL was generated using the name of the machine it was deployed on and whenever I was trying to call the service from a different machine it was complaining that I cannot find the given machine.
You need to test network connectively. One tool you can use is plain old telnet. If you telnet to the ip/port combo of the web server, you will get a response (an HTTP error). For example:
$ telnet 192.168.0.10 8080
If you get nothing then there is almost certainly a firewall blocking access.
If you are convinced that no firewall is blocking you, the other possibility is that the web server is only bound to the local network adapter (127.0.0.1) and not the other network adapters (ethernet/wifi). This is very unlikely however.

Web Service Port No Question

I am working on a web service project using gsoap. I am new to web services and have some basic questions.
What should be the port no. of my web service? Currently this web service is a stand alone service listening to a hard-coded port no. of 22050. Client connects to this port and everything works fine. Is this approach OK? What are the pros/cons of this approach?
Or Should my web service be a plug-in of the apache web server? In that case how does it work? Apache httpd listens on port 80, so client sends request to this port. Then how does the request get routed to my web service?
I didn't find any proper online resources on these. Any pointers would be great.
You will have to configure apache such that it knows it will be your web service. In this case you will probably give it a location. So you can configure a directive that will make sure your service is called by apache.
I.e. you will use urls that identify your service (http://.
You will then use a location directive in which you make the proper configurations. You can find more information at http://httpd.apache.org/docs/2.0/sections.html
Hope this helps.