-1

I currently have the following environment: two App Services for Container, which are two Web APIs deployed with the default domain (azurewebsites.net) and public access that currently work well, example:

  • Swagger documentation endpoint: ...azurewebsites.net/swagger/index.html
  • Business logic endpoints like: ...azurewebsites.net/api/users/select)

Now I need to access them using Application Gateway with a result like the following:

  • https://< public-ip-app-gateway >/api1/swagger/index.html
  • https://< public-ip-app-gateway >/api2/swagger/index.html

that is, according to a path the App Gateway redirects me to the corresponding Web API and I can use the endpoints, this with the goal in the end that the Web APIs do not remain public

I followed the documentation to configure App Service with App Gateway and App Gateway with path-based routing rules but when I finish the steps and access the URLs I get a 404 Not Found

I would appreciate any additional information that I should take into account or that I am missing to carry out this configuration.

Update:

  • Log stream App Service:

    2025-02-19T13:22:20 Welcome, you are now connected to log- streaming service.Starting Log Tail -n 10 of existing logs ----/appsvctmp/volatile/logs/runtime/container.log 2025-02-19T13:21:18.2859098Z info: Microsoft.Hosting.Lifetime[14] 2025-02-19T13:21:18.2859870Z Now listening on: http://[::]:443 2025-02-19T13:21:18.2865131Z info: Microsoft.Hosting.Lifetime[0] 2025-02-19T13:21:18.2865338Z Application started. Press Ctrl+C to shut down. 2025-02-19T13:21:18.3039270Z info: Microsoft.Hosting.Lifetime[0] 2025-02-19T13:21:18.3039765Z Hosting environment: Production 2025-02-19T13:21:18.3039796Z info: Microsoft.Hosting.Lifetime[0] 2025-02-19T13:21:18.3039888Z Content root path: /app 2025-02-19T13:21:22.9290723Z warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3] 2025-02-19T13:21:22.9293296Z Failed to determine the https port for redirect.Ending Log Tail of existing logs ---Starting Live Log Stream --- 2025-02-19T13:23:20 No new trace in the past 1 min(s).

2
  • Daniel Cuellar what does your azure app service log stream show? Commented Feb 19 at 9:23
  • @SirraSneha the log stream of app service only show de logs of server start-up, I added in question Commented Feb 19 at 13:29

1 Answer 1

0

when I finish the steps and access the URLs I get a 404 Not Found

Make sure both App Services are correctly added to the Backend Pool in Application Gateway like below.

enter image description here

As you have two App service, use path-based routing rules as shown below.

Rules-> Add multiple targets to create path-based rule -> Configure the Details ->Save.

enter image description here

enter image description here

Please refer this MS Documentation for better understanding about path-based routing.

  • As Azure Web Apps uses HTTPS, ensure Application Gateway Backend Settings also use HTTPS.

To know whether backend services are working fine or not, set up a Custom health probe in azure Application Gateway.

  • If the configured health probe receives a 200 OK response, Application Gateway routes traffic to that backend.

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.