unlighthouse icon indicating copy to clipboard operation
unlighthouse copied to clipboard

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

Open AshSimmonds opened this issue 1 year ago • 2 comments
trafficstars

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:

  • https://mayfairfinanceaustralia.com/reports/businessfinance/screenshot.jpeg

Actual URL example:

  • https://mayfairfinanceaustralia.com/seo/reports/20240408_0243/reports/businessfinance/screenshot.jpeg

Reproduction

No response

System / Nuxt Info

No response

AshSimmonds avatar Apr 07 '24 18:04 AshSimmonds

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.

AshSimmonds avatar Apr 07 '24 18:04 AshSimmonds

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

harlan-zw avatar Apr 24 '24 11:04 harlan-zw

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

harlan-zw avatar Oct 16 '24 03:10 harlan-zw