Skip to content

feat: Add ability to disable ipx #1653

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 18 commits into from
Oct 3, 2022
Merged

feat: Add ability to disable ipx #1653

merged 18 commits into from
Oct 3, 2022

Conversation

ericapisani
Copy link

@ericapisani ericapisani commented Oct 3, 2022

Summary

Allows for the ability to disable ipx via the DISABLE_IPX environment variable.

If this is enabled, this will require users to a loader (such as Cloudinary), otherwise the images that would've previously been served by ipx will return a 404.

Test plan

Deploy preview - https://ep-disable-ipx.netlify.app

  • Visit 'Rewrite (should display image)' link
  • Images should not render and return 404s within the network tab

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

Fixes #1605

Related documentation PR: https://github.com/netlify/docs/pull/2414

PXL_20221001_220245959

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.

@ericapisani ericapisani added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Oct 3, 2022
@ericapisani ericapisani requested a review from a team October 3, 2022 13:56
@ericapisani ericapisani self-assigned this Oct 3, 2022
@netlify
Copy link

netlify bot commented Oct 3, 2022

Deploy Preview for next-hp-edge-demo ready!

Name Link
🔨 Latest commit 59b1c9e
🔍 Latest deploy log https://app.netlify.com/sites/next-hp-edge-demo/deploys/633b33b41f5c130009e8f379
😎 Deploy Preview https://deploy-preview-1653--next-hp-edge-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Oct 3, 2022

Deploy Preview for netlify-plugin-nextjs-demo ready!

Name Link
🔨 Latest commit 59b1c9e
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-demo/deploys/633b33b45765e100092f1194
😎 Deploy Preview https://deploy-preview-1653--netlify-plugin-nextjs-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Oct 3, 2022

Deploy Preview for next-plugin-rsc-demo ready!

Name Link
🔨 Latest commit 59b1c9e
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-rsc-demo/deploys/633b33b454e7020008f641ec
😎 Deploy Preview https://deploy-preview-1653--next-plugin-rsc-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Oct 3, 2022

Deploy Preview for netlify-plugin-nextjs-export-demo ready!

Name Link
🔨 Latest commit 59b1c9e
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-export-demo/deploys/633b33b46b8ec70009e1243c
😎 Deploy Preview https://deploy-preview-1653--netlify-plugin-nextjs-export-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Oct 3, 2022

Deploy Preview for next-plugin-canary ready!

Name Link
🔨 Latest commit 59b1c9e
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-canary/deploys/633b33b420cd54000930305a
😎 Deploy Preview https://deploy-preview-1653--next-plugin-canary.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Oct 3, 2022

Deploy Preview for next-plugin-edge-middleware ready!

Name Link
🔨 Latest commit 59b1c9e
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-edge-middleware/deploys/633b33b49787da0008009cdc
😎 Deploy Preview https://deploy-preview-1653--next-plugin-edge-middleware.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Oct 3, 2022

Deploy Preview for nextjs-plugin-custom-routes-demo ready!

Name Link
🔨 Latest commit 59b1c9e
🔍 Latest deploy log https://app.netlify.com/sites/nextjs-plugin-custom-routes-demo/deploys/633b33b42945e2000839f7b2
😎 Deploy Preview https://deploy-preview-1653--nextjs-plugin-custom-routes-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Oct 3, 2022

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

Name Link
🔨 Latest commit 59b1c9e
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-static-root-demo/deploys/633b33b427db580009269a7a
😎 Deploy Preview https://deploy-preview-1653--netlify-plugin-nextjs-static-root-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Oct 3, 2022

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

Name Link
🔨 Latest commit 59b1c9e
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-nx-monorepo-demo/deploys/633b33b4d584ec0008a1392f
😎 Deploy Preview https://deploy-preview-1653--netlify-plugin-nextjs-nx-monorepo-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Oct 3, 2022

Deploy Preview for next-i18next-demo ready!

Name Link
🔨 Latest commit 59b1c9e
🔍 Latest deploy log https://app.netlify.com/sites/next-i18next-demo/deploys/633b33b49458e30008a70cea
😎 Deploy Preview https://deploy-preview-1653--next-i18next-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Oct 3, 2022

Deploy Preview for ep-disable-ipx ready!

Name Link
🔨 Latest commit 59b1c9e
🔍 Latest deploy log https://app.netlify.com/sites/ep-disable-ipx/deploys/633b33b4b34cf10008466975
😎 Deploy Preview https://deploy-preview-1653--ep-disable-ipx.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Oct 3, 2022

Deploy Preview for netlify-plugin-nextjs-next-auth-demo ready!

Name Link
🔨 Latest commit 59b1c9e
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-next-auth-demo/deploys/633b33b43b5d56000968b73b
😎 Deploy Preview https://deploy-preview-1653--netlify-plugin-nextjs-next-auth-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

if (destr(process.env.DISABLE_IPX)) {
// If no image loader is specified, need to redirect to a 404 page since there's no
// backing loader to serve local site images once deployed to Netlify
if (!IS_LOCAL && imageconfig.loader && imageconfig.loader === 'default') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[sand] does this need the check for imageconfig.loader?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I had written that out of habit when a property is optional, but this could be achieved with the imageconfig.loader === 'default' check

ascorbic
ascorbic previously approved these changes Oct 3, 2022
@kodiakhq kodiakhq bot merged commit ee7ceda into main Oct 3, 2022
@kodiakhq kodiakhq bot deleted the add-disable-ipx-option branch October 3, 2022 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prevent creation of IPX function
3 participants