Angular PWA in IIS subfolder not work offline

前端 未结 3 777
灰色年华
灰色年华 2021-01-24 01:57

When I publish angular pwa application to subfolder in IIS, pwa application not work in offline.

ng build --prod --baseHref=/subfolder/ does not help.

I use htt

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-24 02:48

    Issue that i faced was, After deployment on Azure, Angular PWA service worker does not fetch the api response from cache in Offline mode, and also the manifest created was showing error in deployed version, whereas in localhost it was all working perfect. the main issue for me was: By default, IIS does not serve any files that does not have a MIME map associated with it in its (IIS) core settings. To address this challenge, you will need to map the .webmanifest file extension to its appropriate MIME type. For this you need to add following to web.config file:

            
                
                
            
    

    this helps azure to understand our manifest.webmanifest file which otherwise it will not be able to. After this it was able to detect manifest.webmanifest file which solved my both issues, Fetching the response from cache in Offline mode, And also with manifest file now my Angular PWA app was installable with app icon and all other features. You can also refer to my question to get rest of details on ngsw-config.json file and full code for web.config file etc, After deployment Angular PWA service worker does not fetch the api response from cache in Offline mode

提交回复
热议问题