App service is deployed but fails to call index.html page from war file in azure linux service but when i add next to url ex:www.azure.app.serivce.com/index.html it works can please help with me this ?

Omkar Kattimani 0 Reputation points
2023-05-24T08:43:36.7766667+00:00

using the Azure app service as java 8 and tomcat 8.5 war is getting deployed currently.

but whenever i hit the url its giving while label error. but when i add index.html next to urs its work and shows the page.

i am using spring boot with angular.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,173 questions
{count} votes

2 answers

Sort by: Most helpful
  1. VasimTamboli 5,215 Reputation points
    2023-05-24T18:30:12.54+00:00

    Here are a few suggestions to troubleshoot and resolve the issue:

    Ensure the root URL is correctly mapped: Check the configuration of your Azure App Service to ensure that the root URL ("/") is correctly mapped to the index.html file. In some cases, the default configuration might be pointing to a different default document or not handling the root URL correctly.

    Configure default documents: In Azure App Service, you can specify a list of default documents that the server should look for when a directory is requested. Make sure that index.html is included in the list of default documents in your App Service configuration. To configure default documents, go to the Azure portal, navigate to your App Service, select Configuration, and under Default documents, ensure that "index.html" is listed.

    Verify the context path: If you are deploying your Spring Boot application with a context path other than the root ("/"), make sure that the context path is configured correctly in your application and in the Azure App Service settings. For example, if your application is deployed with a context path of "/myapp", you would need to access it via "www.azure.app.service.com/myapp" to see the index.html page.

    Check server-side routing configuration: If you are using server-side routing in your Angular application, make sure that the routing configuration is correctly set up to handle the root URL ("/"). Ensure that your server-side routing is correctly configured to redirect requests to the index.html file.

    By checking and adjusting these configurations, you should be able to ensure that the root URL ("/") properly loads the index.html page from your deployed WAR file in Azure Linux App Service.

    1 person found this answer helpful.
    0 comments No comments

  2. Grmacjon-MSFT 19,151 Reputation points Moderator
    2023-07-11T06:13:38.1233333+00:00

    Hi @Omkar Kattimani ,

    Thanks for the question. Adding to the above responses-

    The "Whitelabel Error Page" error message typically indicates that Spring Boot is unable to find a suitable handler for the request. This can happen if the request is not being routed to the correct controller or if the controller is not configured correctly.

    In your case, it sounds like the issue may be related to the routing of requests to your Spring Boot application. When you add "index.html" to the URL, the request is being routed correctly and the page is displayed. However, when you access the URL without "index.html", you are seeing the "Whitelabel Error Page" error message.

    To fix this issue, you may need to configure your Spring Boot application to handle requests to the root URL ("/") and route them to the correct controller. You can do this by adding a @RequestMapping annotation to your controller class or method.

    Here is an example of how to add a @RequestMapping annotation to a controller method:

    @Controller
    public class MyController {
        @RequestMapping("/")
        public String index() {
            return "index";
        }
    }
    

    In this example, the @RequestMapping annotation is added to the index() method of the MyController class. This method returns the name of the view that should be displayed when the root URL ("/") is accessed.

    By adding a @RequestMapping annotation to your controller, you should be able to route requests to the correct handler and avoid the "Whitelabel Error Page" error message.

    Hope that helps.

    -Grace

    0 comments No comments

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.