nuxt-community / pwa-module

Zero config PWA solution for Nuxt.js
https://pwa.nuxtjs.org
MIT License
1.24k stars 171 forks source link

301 issues with special characters #551

Open AntoineLemaire opened 11 months ago

AntoineLemaire commented 11 months ago

Hi everyone,

We installed @nuxtjs/pwa into our Nuxt2 project, and we have an issue when worker have cache on 301 redirections on URL with special characters, like ñ

On the same domain, I have 2 projects, some paths are opened with Nuxt, and some others in a PHP (Symfony) project. Everything is managed by nginx to use the right application.

In the PHP app, sometimes I'm doing some 301 redirects to URLs with a special character, example

header("Status: 301 Moved Permanently", false, 301);
header("Location: https://my-domain.org/niñera");
exit();

This URL is handled by Nuxt App. But since I've installed @nuxtjs/pwa, if worker has been loaded a first time, the redirection does not work, because it redirect to /niñera instead of /niñera (or the url-encoded version : /ni%C3%B1era)

Without Service-worker: image

With Service-worker: image

My config is pretty simple:

    pwa: {
        icon: false,
        meta: false,
        manifest: false,
        workbox: true,
        onesignal: false,
        offline: false,
    }

I also tried to set everything networkOnly

        workbox: {
            runtimeCaching: [
                {
                    urlPattern: ".*",
                    handler: "networkOnly",
                },
            ],
        }

But I don't understand what happen, and how to avoid that.

Does anyone have an idea how I can deal with those special characters in 301 redirect ?

Thanks