Flutter Web - Azure hosting - .json blocked

Kiran 6 Reputation points
2021-09-17T13:43:58.16+00:00

Hi All,
We are trying to host a flutter web app. After loading the build, applications fails to load AssetManifest.json kinds of files. I tried even kept a web.config ( i know it is not a dotnet app), still i did. But with no luck. Please help me in resolving it

Thanks in advance,
Kiran

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

3 answers

Sort by: Most helpful
  1. Grmacjon-MSFT 19,301 Reputation points Moderator
    2021-09-17T22:27:53.46+00:00

    Hi @Kiran ,

    We are sorry you're facing this issue. is there a specific doc or tutorial you're following to host your flutter app on azure? also. can you please share the full error message you're getting when you deploy your app? In the meantime, please check out this similar SO thread.

    Thanks,
    Grace


  2. Takahito Iwasa 4,851 Reputation points MVP Volunteer Moderator
    2021-09-19T16:09:01.73+00:00

    Hi.

    Is the App Service environment you ran Windows? Windows
    Then, as Grmacjon says, it may work by setting the file in Web.config.
    For Linux, you may need to make other settings.

    0 comments No comments

  3. Jared Baszler 11 Reputation points
    2022-03-15T17:49:01.833+00:00

    I had the same issues getting .json and font files when deploying a Flutter web app to an Azure App Service. This is what I needed to do:

    When ready to deploy, create the deployable web project with:

    flutter build web
    

    That creates a folder at the following path:

    /project root/build/web
    

    Once that is done - I had to place a web.config file at the root of the web project (same path as above) with these contents. I was having trouble with both .json and font files getting blocked.

    <?xml version="1.0"?>
    
    <configuration>
        <system.webServer>
            <staticContent>
                <mimeMap fileExtension=".json" mimeType="application/json" />
                    <mimeMap fileExtension="woff" mimeType="application/font-woff" />
                    <mimeMap fileExtension="woff2" mimeType="application/font-woff2" />
                    <mimeMap fileExtension=".ttf" mimeType="application/octet-stream" />
                    <mimeMap fileExtension=".ttc" mimeType="application/octet-stream" />
                    <mimeMap fileExtension=".otf" mimeType="application/octet-stream" />
            </staticContent>
        </system.webServer>
    </configuration> 
    

    I'm guessing there could be other static files that could be added to this web.config file as you include them in your project. If so, you'll have to research how those should look in a standard web.config file.

    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.