codeigniter-restserver not working in https connection - authentication

I have created two codeigniter project subdomains.
In domain A I have kept only the controller and view part.
In domain B I have kept only the controller and model part.
I am using controller of domain A to send api calls to controller of domain B using cURL, then using the data sent from domain B to load in the view of domain A.
I have used codeigniter-restserver library by phil sturgeon and used basic authentication for the api authentication.
I am using IIS to host the services.
All the Get and Post request are working proper in this architecture.
But when I enabled ssl in both the domains the api stopped working.
I tried changing the authentication type but it doesn't work with https.
I am not able to find the problem.

After 12 hours of searching for the problem, I found the answer in this post >>
Make https request with curl
Previously I was creating a curl http request which worked without ssl.

Related

AAD Authentication inside AzureKubernetesService

I developed an application that uses Azure AD Authentication for a single tenant.
I would like to host it inside AKS, but it seems not to be possible, as described below:
The problem is that the application must be running as https if it is not in localhost, but my pod is running on http protocol (as usual). Even if my aks cluster service is running as Https, the callback uri seems like to be looking for the protocol on the pod where it's running, so it redirects the request to http://mydomain and not https://mydomain, returning the "Correlation Error" or "app id doesnt exists" (because the mapped uri was https://)
The redirect URI can not be mapped to http on Azure App as described here.
I've made it work using a certificate inside my pod on the application build using Kestrel Certificate. But it seems not to be a good solution.
Does anyone knows a more suitable workaround?
As of now there is no other solution available as we have restrictions in redirect URL as per the document you are following.

Blazor Server Reverse Proxy with Authentication

I have a blazor server-side application (netcore 3) which uses authentication through OpenID / Okta.
I started testing it through IIS, and running it as a regular website worked just fine.
But, I need to run it through a reverse proxy due to the rest of our setup, and after I set that up the blazor site no longer functions.
Our reverse proxy is simple, just takes a url (https: //subdomain.domain.com), and routes it internally (http: //localhost:8093). There are other sites connected here, this was just an example.
I managed to get all the resources (css, js, images) working correctly by adding the "app.UseForwardedHeaders", but I am still having an issue with Authentication.
For Authentication, it's setup with services.AddAuthentcation, and AddOpenIdConnect, which is triggered by an MVC call to Account/Login, that issues the HttpContext.ChallengeAsync.
Running the application standalone, or in it's website, the Login works, and redirects to Okta (https: //oktadevurl.com/oauth2/default/v1/authorize?parameters).
Through the reverse proxy, this url becomes relative to the Proxy address (https: //subdomain.domain.com/oauth2/default/v1/authorize?parameters) which is incorrect.
I've double checked the forward headers, and OpenId / Okta settings. I'm looking for anyone who has had this issue before and could point me in the right direction on how to get the absolute urls working from blazor through the reverse proxy.
Thanks.
I was able to solve this with one little checkbox is ARR:
In IIS Manager, Select the current server (not the website), open Application Request Routing, and on the right hand column there will be an option Server Proxy Settings. There you will see "Reverse rewrite host in response headers" option. If that is checked - uncheck it and your problem should be solved.

Ant-Media-Server + SSL without Domain

Ant-Media-Server is running on an IPAdress without any domains. We just set up this server to be used for streaming in order to use it from different domains pointing to different servers.
Since all of our domains use ssl, we face the typical connection problem:
mixed Content: The page at 'https://SOMEDOMAIN.com/QUERY' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://1.2.3.4:56'. This request has been blocked; this endpoint must be available over WSS.
Ant-Media already offers tutorials on how to install a Let's Encrypt SSL Certificate but sadly it is not available for pure IP-Addresses.
Apart from the Ant-Media Service, the server doesn't has any NGINX, NodeJS, Apache or other http Servers installed - the plan was just to use it for streaming by calling the IP-Address.
Do you have any ideas on how to solve that problem?
Unfortunately, this is not possible.
The goal of having a SSL is ensure you are requesting the right domain name besides encrypting the content between your users and your server.
Here are some alternatives:
create an endpoint in your own app that proxies data to your server.
Instead of playing the IP address, you can play:
/your-proxy-url?stream=http://yourIp.com:port/....
Note that using a proxy will make all the traffic pass through your web app.
As a reference, if you are using PHP on your website, you can have some ideas from here: https://gist.github.com/iovar/9091078
Create a reverse-proxy in front of your web app that redirects the traffic to your IP address.
Both solutions does not change your Ant Media Server, just adds a new resource between your users and your streaming server - adding the SSL on it.

Forwarding API calls from a sub dominos to static IP address(from ISP)

I currently have an API setup at
http://public_static_IP:5000/api/parameters (POST requests).
I have bought a domain from NameCheap and hosted in GoDaddy, also added SSL from Cloudflare.
I have created a URL Redirect of a subdomain(http://www.web.domain.com) to http://public_static_IP:5000, which is a webpage and it is working fine.
I did the same with another subdomain(http://www.api.domain.com) to API endpoint which is an only POST request, so when I add all parameters and send a post request to this subdomain it is giving Method not allowed.
This is very important for us as users will always be using this API service and we don't want any downtime(sometimes ISP will be down), if ISP is down we want to temporarily route to some cloud service(AWS or Google Cloud) without asking users to change their base URL always.
Thanks in advance.

Application Request Routing IIS load balancing HTTPS setup causing 301 redirect

I have setup load balancing server with Application request routing on IIS, it's working fine but I am facing issue with https requests, they are being redirect(301) and in post call it's losing the post data.
I have disabled SSL offloading but still the https post requests are failing and taking me to login page due to post data not being forwarded to ARR or something.
Thanks
for now, I have added * binding and that seems to be working, not sure why it doesn't work when I specify the domain name in binding. but it's sorted by problem so good for now, but will be better to know how it will work with domain name in the binding.