-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trailing slash resolves in 404 #23
Comments
I have a similar problem, where trailing slashes always end up on the root path |
Can you configure tralingSlash in Astro? https://github.com/vite-pwa/astro/blob/main/src/index.ts#L54 |
thanks for the quick answer. yes I've now done that, trying both combinations.
Example Links:
The optimal case would be if it did not matter if a trailing slash is used or not. |
Just found: https://github.com/slorber/trailing-slash-guide which explains the behavior of github pages for different links, notably: /file - ✅ This further confirms that |
I have done a quick test repro with a simple astro project that builds using Both of these urls work:
So it seems the problem is really service worker related.. |
IIRC there is a directoryIndex and cleanUrl in workbox option: EDIT: maybe both options wth another names, the link is about using the workbox modules. |
I Will try to check your repro tmr. |
On first sight that sounds like it would help in this case!
Thanks! For completeness sake, I've now done a full reproduction that shows how adding @vite-pwa/astro to the mix results in wrong caching behavior:
|
can you deploy using |
Since you're deploying to gh pages, the scope is the project name without final slash (check the sw pre cache manifest in your deployed app) and so the sw maybe intercepting the |
Preparing PR to not modify the sw precache manifest when using directory, on local works for |
Astro build is inconsistent, why |
@felixroos can you test in local with current PR or review it (GH Pages maybe will fail from your url since |
You can open the pwa-example using this StackBlitz repro. EDIT: stop dev server and run |
deployed, but it only logs "SW registered: ..." atm
can test tomorrow (if it's still relevant)
with the stackblitz example seems to work fine! |
@felixroos don't forget to include It seems SB has fixed the I'll check why |
https://felixroos.github.io/astro-test-pwa/ now deployed with autoUpdate + menu |
@felixroos can you try building the branch and using file protocol to install it in your repo?
|
done: https://felixroos.github.io/astro-test-pwa/ works! |
@felixroos Now the dilemma in this repo with the PR, I'm afraid to put it as is, perhaps with a flag to activate it? EDIT: in any case, the owner can plug its own |
You mean because an opt-in flag won't break existing setups that rely on the old behavior? |
YES (I'll check it next week, maybe you can update the PR, I need to rest...) |
I'm not sure as I have too little knowledge of this project to give my opinion on it. Of course, having less config options is always a plus, but maybe the old behavior is sometimes desired, not sure. From my perspective this looks more like a bug that should probably be fixed by default, but maybe it introduces some regression. |
I can see what I can do, please give yourself some rest. I can also wait or use the tgz |
The problem, I don't use Astro, I switched to Nuxt 3... This repo should be in Astro repo, but the PR was closed a few times without any explanation and finally added here (íles integration for example in the repo not in Vite Org) |
@felixroos I'll add it under experimental, like PWA VitePress Integration, check this PR: vite-pwa/vitepress#23 |
thanks! |
@felixroos can you run the same process with the branch in this PR in you GH repro and deploy to GH Pages?
experimental: { directoryAndTrailingSlashHandler: true }
I'm preparing the docs, the experimental option added in VitePress cannot be added, Astro will clone the PWA options and cannot be referenced, it will require a change in |
If you cannot checkout the new branch, just clone the new branch directly. EDIT: forgot it, I'll release a new patch version, now we have the experimental flag... |
@felixroos released v0.1.4 Documentation updated:
|
@userquin thanks for the release! I am now using the new flag and it works :) |
Hi,
The pwa works great but I would like to know how to redirect
/blog/post/
toblog/post
trailing slashes in the url are not resolving.It is a static build
The text was updated successfully, but these errors were encountered: