nginx redirection from webserver to API in app server, but API is running on different ports - nginx-config

I have two web pages are running at server IP1
Party A will be accessible via http://IP1:10009/web/example/PartyA/
and
Party B will be accessible via http://IP1:10012/web/example/PartyB/
The app server is running at IP2
Now Party A has to access the API from app server IP , with endpoint
http://IP2:10015/api/example/me
and
Party B has to access the same API , with end point
http://IP2:10018/api/example/me
Can we configure this in nginx ?
I have one webserver IP1 and app server IP2 in development environemnt, need to use nginx in demo environment

Related

Connecting services without Dapr

New to Container Apps.
I'm trying to understand basic connectivity between services in Container Apps.
Lets say I have a web front in .Net Core and an Web API backend (.Net Core).
Without containerization, I could put the base address of my web api in my app settings of the front end to connect to the api, lets say localhost:5000 etc. Using an httpClient to do the call.
If I containerize the front end and api and deploy it to ACA, what would that look like? I think its would be like:
Ingress external for front end
Ingress internal for api
Port 80 for both front end and web api????
Or do I need to setup a base address of some sort to call the web api? Or an environment variable?
I put both ports to 80 but they cannot seem to connect.
Thanks!
In your "Without containerization" example, if your web ui is running on localhost:8080 for example, and your API is running on localhost:5000 then you'll need to enable CORS on the api. In That example, both your web ui and your api are "external". Anything you need to call from a browser is 'external'.
Internal only are for server to server communication, or microservices communicating with each other.
In your example, you'd deploy both as external apps, this will give you 2 domains https://webui.env.region.azurecontainerapps.io and https://api.env.region.azurecontainerapps.io then you will configure a CORS policy on the api app.
see this for more details

Ocelot setup to redirect user on a react application

We are doing some server set up.
We are using a Api gateway(Ocelot) installed on the server Y which will connect to Apis hosted on server X.
Server X also has a react application.
Server Y is accessible over Internet where as server X is accessible from server Y.
Now the Apis are working perfectly but the react application is not opening through the ocelot ( server Y).
So question is will ocelot open react application?
Are you deploying the ocelot api gateway in a DMZ and the react-app and web services, database behind the firewall and allow only specific access via browser, mobile.
is this a pwa site, then you should be careful about using ocelot for something that is not intended for. ocelot is an api gateway tool/technology and not unlike nginx that can perform this additional activity of routing the calls to web application and web services.
please check the documentation of ocelot api gateway, if it allows for web application routing as well.

Can a webserver redirect https requests to another webserver's http?

I'm using a package that connects to a database and presents the database schema as APIs. The package provides the service as a webserver. I can choose to use any port, but it's still HTTP. Even if I run it with port 443, requests must be in the form of http://mydomain:443/
I may be forced to provide the service through SSL. Is it possible to run a webserver which would redirect HTTPS requests to redirect to the package running HTTP on port 80, with the outgoing traffic going back through the webserver to clients as SSL? Essentially, I need some kind of wrapper around the existing app to provide SSL.
If such a thing is possible, which webserver would be the best choice and easiest to administer on Linux?

Intercept all outgoing connections made by a process to redirect it to a localhost proxy

I am working in an environment where there are multiple services hosted. A service(consider web services) exposes some APIs and also acts as client to call other services too.
Now what I want to achieve is that if Service A (acting as client) wants to talk to Service B(acting as server here) using http , then I want to intercept outgoing HTTP request and redirect it to localhost proxy.
There are multiple services running on a host and a service also talks to multiple other services, so I don't want to change the configuration of every outgoing endpoint configuration to point to proxy.
Sample configurations:
Following are the services endpoint which service A connects while doing some processing like:
a1.example.com:2430
a2.example.com:8280
a3.example.com:4380
a4.example.com:4280
a5.example.com:3158
a6.example.com:8238
I have looked into configuring squid proxy as transparent proxy. But how should I enforce every outgoing connection (with different destination ports ) to redirect to localhost proxy.

Hosting WWW and RESTful service ont the same machine

Can a WCF RESTful service and a regular site/www service be hosted concurrently? Or do I need a seperate machine to host WCF?
Thanks.
Yes. they can be hosted on the same machine (depending on whether you are using shared hosting). If you have the permission, you just need to bind them to different ports.
For example, if your website is hosted on port 80 (which is usually the default), then you can create another website on the same machine hosted on port 8080 for the WCF HTTP service.
If your website is a .NET app pool, you can even host the WCF service inside the same app pool as your website, by using a virtual directory.
Also, you can host multiple websites on the same port if you differentiate them by host headers.