Can I use http api in static azure web app

258 views Asked by At

My API is hosted on-premise machine with HTTP (not HTTPS). My client app also was hosted on-premise with HTTP. Now I want to deploy my client app in azure static web app. I finished deployment, but start getting this error:

The page at 'https://[address]/sign-in' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://[apiaddress]/signin'. This request has been blocked; the content must be served over HTTPS.

Is there any solution to resolve this issue without migrating my api to HTTPS? Can I configure it on azure static web app or run it over HTTP?

1

There are 1 answers

0
SiddheshDesai On BEST ANSWER

It is not possible use HTTP URL in the Azure Static Web app, As after your Static Web app and API deployment, Azure will add the client certificate and HTTPS binding by default. Refer below:-

enter image description here

One alternative as mentioned in this MS Q & A answer is to use Custom Domain with HTTP only setting or by enabling HTTP only setting in Azure Web app Configuration. And Deploying your Static Web App and API in Azure Web App instead of Azure Static Web app, as Azure Web App has an option of Disabling HTTPS only setting. But Azure Web app also adds client certificate and HTTPS binding by default. But by disabling HTTPS Only setting, You are able to browse your Website in HTTP, Refer below:-

Refer my SO thread answer to deploy Static Web app in Azure Web app.

I deployed one Static Web app with API in Azure Web app with below Version and OS:-

Version - Node 18 OS - Linux

After deployment, I disabled HTTPS only to Off setting from Configuration like below:-

enter image description here

Now, I can browse the URL with both HTTP and HTTPS like below:-

With HTTP:-

enter image description here

With HTTPS:-

enter image description here