Unintended add '/' to the end in URL after upgrading v9 (PageSpeed Insights) #13373
FAQ
- [X] Yes, my issue is not about variability or throttling.
- [X] Yes, my issue is not about a specific accessibility audit (file with axe-core instead).
URL
https://pagespeed.web.dev/report?url=https%3A%2F%2Fwww.google.com
What happened?
Follow these URLs:
- https://pagespeed.web.dev/report?url=https%3A%2F%2Fwww.google.com
- https://pagespeed.web.dev/report?url=https%3A%2F%2Fwww.google.com%2F
It is quite different, but when entering it, the URL at the box of the pagespeed insight is the same (always have the '/' in the end)

This thing is never happening on v7 or v8.
What did you expect?
Keep the same behavior as previous version
What have you tried?
No response
How were you running Lighthouse?
PageSpeed Insights
Lighthouse Version
v9.0.0
Chrome Version
No response
Node Version
No response
OS
No response
Relevant log output
No response
Trailing slashes after the domain shouldn't matter so https://www.google.com is the same as https://www.google.com/.
PSI does not force a trailing slash when it does identify a different URL (e.g. https://web.dev/learn-web-vitals vs https://web.dev/learn-web-vitals/). I think this is WAI.
We have two different places that normalize URLs. And one of them conditionally adds a trailing slash while the other doesn't.
We should make them operate consistently.
Agree with adam that it probably doesn't make a material difference, but since we're getting picky about URLs we should be consistent ourselves.
Hi @adamraine, @paulirish
With these websites that use Next.js, by default, it will redirect if the URL has trailing '/'. For more detail, please visit the document: https://nextjs.org/docs/api-reference/next.config.js/trailing-slash
Because of redirecting, the URL has trailing '/' have the LOWER score than the URL not having trailing '/'
So please keep the lighthouse the same behavior as the previous version
Please see the screenshot below

I had the same misunderstanding you did: yes, https://nextjs.org/docs/api-reference/next.config.js/trailing-slash is a different url from https://nextjs.org/docs/api-reference/next.config.js/trailing-slash/, but https://nextjs.org does not exist [1]. You can do new URL('https://nextjs.org').href (or .pathname) to see that the url path is normalized to be at least /, and can never be an empty string.
If you type https://nextjs.org/docs/api-reference/next.config.js/trailing-slash in the input box in pagespeed you will see we do not add a slash.
[1] Probably more accurate to say it is normalized. context
Fix (internal): cl/410531354
This should be fixed, eg https://pagespeed.web.dev/report?url=https://nextjs.org/docs/api-reference/next.config.js/trailing-slash no longer appends a trailing slash to the URL, but feel free to reopen if there's anything missed.