Skip to content

fix: bypass preview for static files #918

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

Merged
merged 2 commits into from
Dec 7, 2021
Merged

fix: bypass preview for static files #918

merged 2 commits into from
Dec 7, 2021

Conversation

ascorbic
Copy link
Contributor

@ascorbic ascorbic commented Dec 7, 2021

Summary

Currently we have a forced redirect to the handler funciton if preview mode is on, as it needs to bypass ODBs and SSG pages. However this means it also forces a rewrite for files from public, causing broken images and other static files. This PR adds no-op rewrites for any files from that directory, ensuring that they don't match the force redirect and are instead served from the CDN.

Test plan

  1. Enable preview mode on the deploy preview
  2. Load the image from the index page and check it is found

Relevant links (GitHub issues, Notion docs, etc.) or a picture of cute animal

Closes #753

Standard checks:

  • Check the Deploy Preview's Demo site for your PR's functionality
  • Add docs when necessary

🧪 Once merged, make sure to update the version if needed and that it was published correctly.

@netlify
Copy link

netlify bot commented Dec 7, 2021

✔️ Deploy Preview for netlify-plugin-nextjs-static-root-demo ready!

🔨 Explore the source changes: 0d7c905

🔍 Inspect the deploy log: https://app.netlify.com/sites/netlify-plugin-nextjs-static-root-demo/deploys/61af50ae1377350007c1e5f2

😎 Browse the preview: https://deploy-preview-918--netlify-plugin-nextjs-static-root-demo.netlify.app

@ascorbic ascorbic requested a review from tiffafoo December 7, 2021 10:34
@github-actions github-actions bot added the type: bug code to address defects in shipped code label Dec 7, 2021
@netlify
Copy link

netlify bot commented Dec 7, 2021

✔️ Deploy Preview for netlify-plugin-nextjs-nx-monorepo-demo ready!

🔨 Explore the source changes: 0d7c905

🔍 Inspect the deploy log: https://app.netlify.com/sites/netlify-plugin-nextjs-nx-monorepo-demo/deploys/61af50ad6db60100077ab551

😎 Browse the preview: https://deploy-preview-918--netlify-plugin-nextjs-nx-monorepo-demo.netlify.app/

@ascorbic ascorbic self-assigned this Dec 7, 2021
@kodiakhq kodiakhq bot merged commit ecb3cc8 into main Dec 7, 2021
@kodiakhq kodiakhq bot deleted the mk/fix-static-prefix branch December 7, 2021 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Images in public files don't load while in preview mode
2 participants