Skip to content
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

Payload URLs are missing the configured cdnURL #22199

Open
oliversalzburg opened this issue Jul 18, 2023 · 5 comments · May be fixed by #26668
Open

Payload URLs are missing the configured cdnURL #22199

oliversalzburg opened this issue Jul 18, 2023 · 5 comments · May be fixed by #26668

Comments

@oliversalzburg
Copy link

Environment

Reproduction

Describe the bug

You're not attaching the cdnURL to the paths you generate for "payloads":

const payloadURL = _PAYLOAD_EXTRACTION ? joinURL(useRuntimeConfig().app.baseURL, url, process.env.NUXT_JSON_PAYLOADS ? '_payload.json' : '_payload.js') : undefined

Additional context

Not sure why this setting should only apply to some URLs and not others. If this is by design, feel free to close.

Logs

No response

@danielroe
Copy link
Member

danielroe commented Jul 18, 2023

This is a good point. The reason is that payloads are meant to support not just prerendering but also runtime generation if you are running a server. However, there's clearly a situation when we would want to use the CDN URL here. 🤔

@oliversalzburg
Copy link
Author

oliversalzburg commented Jul 25, 2023

Just to give some context:

My task in this context was actually to deploy a Nuxt rendered output, as static pages, to S3-based simple website hosting. These pages were error pages, that should be presented at the requested URL if the request resulted in an error. When I served the pages at the given URL, they would always fall into a "404 state", because the current URL wasn't in the routing of the application.

The first I learned, was that another developer used a ClientOnly node in the pages, because they thought it would be the right solution for another problem they faced. It was not the right solution, as we were aiming for fully static pages.

Once I fixed that, I noticed that the entire JS usage dropped to pretty much zero, and that these payloads also didn't seem to contain any really meaningful data.

So I went with the following configuration bits:

  experimental: {
    noScripts: true,
    payloadExtraction: false,
  },

The resulting pages were fully static HTML pages that I could serve from any host, or path. All other links in the document respected the cdnURL already through one mechanism or the other.

Sorry if any of the terminology is off. I'm in unknown territory here 😅

@danielroe
Copy link
Member

Thoughts @pi0?

@danielroe
Copy link
Member

I think we can implement once #21641 is merged.

@tresko
Copy link
Contributor

tresko commented Apr 5, 2024

@danielroe any news about implementation? I can help if you want :)

@tresko tresko linked a pull request Apr 5, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants