Azure Web App - Front End Not Connecting with Backend

Nick Gotsy 0 Reputation points
2023-10-31T00:46:21.1066667+00:00

After hosting my front and backend applications through Azure Web App, I cannot get my front end to hit an endpoint on my backend. I continuously receive a 400 Bad Request from axios.

This used to be my local endpoint:

https://localhost:7047/api/forum

Then, I switched out the root URL to what was listed as my URL under the properties section on Azure:

https://nicksportfolio.azurewebsites.net/api/forum

On my .NET app, my CORS is configured as to allow origin:

{
    builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader();
    }));

I even went on the CORS section on Azure and set the 'Allowed Origins' to '*' as to allow access from any source to my endpoint (I'm aware this is a security concern and will change it in the future)

Any ideas what the issue might be?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,913 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 26,721 Reputation points Microsoft Employee
    2023-11-02T20:30:43.58+00:00

    Apologies for the delayed response.

    Based on the issue description, I understand that you are having trouble connecting your front-end application to your back-end application hosted on Azure Web App.

    To better assist you on this, are you using any authentication or authorization mechanism for access the WebApp? Are these two WebApps hosted on a VNET?

    --You may always leverage App Service diagnostics from Azure Portal> Navigate to your App Service app in the Azure Portal. (screenshot below)

    In the left navigation, click on Diagnose and solve problems - Review and run – Network troubleshooter and ““Configuration and Management”  (IP address configuration)

    --To narrow down the issue, you may checkout the step-step instructions outlined by one of colleague on their own blog section: app service network troubleshooting

    See: Troubleshoot outbound connectivity on Windows/Linux Apps section

    Kindly let us know how it goes and provide more info about your application, I'll follow-up with you further.

    User's image


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.