harlan-zw / unlighthouse

Scan your entire site with Google Lighthouse in 2 minutes (on average). Open source, fully configurable with minimal setup.
https://unlighthouse.dev
MIT License
3.88k stars 115 forks source link

Static reports 404 on sub-reports and thumbnails as `/reports` (leading slash) is hardcoded somewhere in `_ctx.report.artifactUrl` #201

Closed AshSimmonds closed 1 month ago

AshSimmonds commented 7 months ago

Describe the bug

Only been playing with it an hour or so, can't pinpoint exactly where yet, but when you deploy a static site that's in a sub-directory, some of the thumbnails and all the individual page reports have the URL beginning with /reports/, which refers back to example.com/reports/unlighthouse-report/the-file, instead of example.com/unlighthouse-report/reports/the-file.

screenshot_20240408-042746

screenshot_20240408-042838

What's attempting to be fetched:

Actual URL example:

Reproduction

No response

System / Nuxt Info

No response

AshSimmonds commented 7 months ago

Update: the issue is in the payload.js file, I just did a find/replace for artifactUrl":"/reports to remove the leading slash and everything works, so wherever that initial generation comes from.

harlan-zw commented 6 months ago

Hi, I think you might want the routerPrefix option? https://unlighthouse.dev/api/config#routerprefix

harlan-zw commented 1 month ago

In 0.14.0 relative paths are used when routerPrefix isn't configured which should solve this.