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

fix(cloudflare): use full mime db #933

Merged
merged 2 commits into from
Feb 8, 2023
Merged

fix(cloudflare): use full mime db #933

merged 2 commits into from
Feb 8, 2023

Conversation

pi0
Copy link
Member

@pi0 pi0 commented Feb 8, 2023

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Reported by @atinux when icon.ico cannot be served on cloudflare deployments.

Investigating this, mapRequestToAsset utility from @cloudflare/kv-asset-handler, appends /index.html always when a mime is not detected based on request extension! We use mime/lite and ico is not there this will cause cloudflare to fail!

image

Best approach is accessing assets meta but as a workaround, this PR uses full mime db (25KB instead of 8KB) for cloudflare.

Before 
  └─ .output/server/index.mjs (1.3 MB) (367 kB gzip)
Ξ£ Total size: 1.3 MB (367 kB gzip)

1272    .output/server/index.mjs


After:

nitro 21:04:18
  └─ .output/server/index.mjs (1.33 MB) (374 kB gzip)
Ξ£ Total size: 1.33 MB (374 kB gzip)

1300    .output/server/index.mjs

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant