1

I configured PWA on my angular 11 project and serve it with http-server on my laptop. It works completely on 127.0.0.1 but when I try to access the app with another device in the local network, the first page load and check authentication and try to navigate to the login page. On login page, I face on "502 Bad Gateway Microsoft-Azure-Application-Gateway/v2" error.

This is my ngsw-config.json:

{
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
"index": "/index.html",
"dataGroups": [
    {
        "name": "mission-api",
        "urls": [
            "/api"
        ],
        "cacheConfig": {
            "strategy": "freshness",
            "maxSize": 20,
            "maxAge": "1h",
            "timeout": "5s"
        }
    }
],
"assetGroups": [
    {
        "name": "app",
        "installMode": "prefetch",
        "resources": {
            "files": [
                "/favicon.ico",
                "/index.html",
                "/manifest.webmanifest",
                "/*.css",
                "/*.js"
            ]
        }
    },
    {
        "name": "assets",
        "installMode": "lazy",
        "updateMode": "prefetch",
        "resources": {
            "files": [
                "/assets/**",
                "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani|json)"
            ]
        }
    }
]

}

And this is the command of http-server:

http-server -p 8282 -c-1 dist -S -C dist/cert.pem -K dist/key.pem --proxy https://xxxxxxx.com --log-ip

Image of error:

Image of error

I can't understand why it works in 127.0.0.1 on my laptop but it doesn't work on another device. Is there another config for PWA or HTTP-server that I lost? or it's related to backend configuration?

Mostafa Farhani
  • 305
  • 2
  • 16

0 Answers0