API Get request being blocked outside of network - api

I built a web app using React and uses Axios to make api calls.
The web application sits on our public server, while the API sits on one of our servers inside our network.
When I or any user use the application while VPN into our network the api request goes through. However, when we try outside of the network we get a timeout error.
I'm able to access the website perfectly fine outside the network with no errors. The timeout error happens when I submit the form and do the axios.get
I have wireshark running on the server where the web application is sitting and below is what errors I'm receiving with trying to make that api call.
What would be causing the TCP Retransmission to switch ports from 443 t0 53027 (which is a dynamic port that changes on every session). What's causing the timeout?

Related

How does API work with application server?

I've read that application server can be accessed via API. But I don't get the mechanism of that process. Does it work like that?
So, as for me, firstly, client sends an HTTP request to a hardware server. Here we start to looking for some data. Then, we connect with application server via API. And then something that was found in hardware server changes with application server. And after all, client receives this changed file. Am I right?
And it looks like API always works only with application server. Is it true?

Difference between hosting a Web API and hosting a website

From what I've gathered, hosting a website on a server is allocating space for the files of your website whereas hosting an API is when the server continuously runs your API to receieve incoming web requests. Is it true that when hosting a website, the server is not running anything? Or is it also continuously running the website waiting for calls.
When you request a website, it makes a call through the network to a server machine that runs an application called a web server, for example Apache HTTP Server. Without that application, it would be unable to respond to your HTTP calls with web pages.
Web pages are just documents and resources, so they are not able to respond by themselves. An API, on the other hand, is usually a separate standalone application that can run on a different machine, and that is often called by web pages.
So the answer is no: the server has to run something even for a static website.
You need a server to "serve" your web-page. It does not matter if is a static page or a dynamic page (html or php). If you have a html page the server will read and sent it to the user(No processing done), if you have a dynamic page like php then the server will process the php code and generate a result usually an HTML page that its serve to the client.
If you have an API is the same approach as the dynamic page, you send parameters, server process them and then give you a result. In the case of an API it may require authentication and the result can be in HTML, XML, JSON for example.

Azure Application Gateway with API as a backend pool is not working

I have .net core API inside the web app and that web app is backend pool for azure application gateway. while trying to access the web app got below error.
"502 - Web server received an invalid response while acting as a gateway or proxy server."
On app GW, health prob for that web app in unhealthy but while access the API as a https://abc.azurewebsites.net/api/values then it works.
When we deploy API in Web App Service then apiname.azurewebsites.net does not work give any probes to application gateway and treat unhealthy. API works like xxx.azurewebsites.net/api/values and Application Gateway also know this path. We have to put /api/values in override backend path of http settings. Same have to do in health probes.
Yes, you can first verify if the backend API could access directly without app gateway. Then this error may happen due to the following main reasons:
NSG, UDR or Custom DNS is blocking access to backend pool members.
Back-end VMs or instances of virtual machine scale set are not responding to the default health probe.
Invalid or improper configuration of custom health probes.
Azure Application Gateway's back-end pool is not configured or empty.
None of the VMs or instances in virtual machine scale set are healthy.
Request time-out or connectivity issues with user requests.
Generally, the Backend healthy status and details could point it out and show some clues. You could also verify all of the above reasons one by one according to this DOC.

Ajax call to the Application Server sitting behind firewall

We have 3 tiered architecture:
Web Server - public (web application deployed) App Server - private (webApi deployed) Db Server - private (sql server installed) And my co-worker said, we have this architecture like this, because its a standard architecture that follows everywhere.
We have been using Asp.net application, where we can make api call from Web Server to App Server without any problem.
But now we have been converting our application from Server side to Client side, i.e. we'll only have js, html & css pages in web application, but problem is, we cannot call api using ajax directly from js, because of the two reason.
our App server is on different domain. App server is behind firewall, means it can only be accessed if we are connected to VPN, or we make a proxy on Web Server, and go through that channel. i.e. js<->Web Server Proxy<->App Server<->Db Server. We want to bypass Web Server from the channel, like: js<->App Server<->Db Server without connecting to VPN, because we don't require user to connect to VPN to use our web application.
Please give your suggestions. Thanks..
You have to enable CORS or cross origin resource sharing. You can research more on that but just want to give idea.

Bypass proxy when calling a web service from a Windows service

I have a Windows service that is calling a web service, passing a string, and returning a success or error message.
Everything has worked fine in all my testing and development... until I tried to roll it out internally on a network with a proxy server. The web service addresses are not internal but they need to bypass the proxy server to work correctly. If I disconnect my machine from our network and access the internet directly it works fine and the web service is accessible, but if I am connected to the corporate network it fails.
I can add a service reference fine because that uses the proxy settings for my user and this address is set to bypass the proxy. I have tried to run the service with my user credentials and it still doesn't work.
This is what I am using to call the web service:
Dim results As String
Dim objJob As CheckValidationKey.ImportProjectInfo = New CheckValidationKey.ImportProjectInfo
objJob.Credentials = System.Net.CredentialCache.DefaultCredentials
results = objJob.CheckValidationKey(ValidationKey)
What I can't seem to figure out is how to bypass the proxy. I have tried options in the app.config without any luck.
I didn't get an answer and would still like one, however, this specific issue is no longer a problem. It turns out that the proxy wasn't even the problem, but rather that the specific network segment I was trying to use had soap requests blocked. All those hours!