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: htmlFallbackMiddleware for favicon #15301

Merged
merged 4 commits into from Dec 12, 2023
Merged

Conversation

patak-dev
Copy link
Member

Description

A favicon.ico request is returning the index.html because it has */* in its header. It seems that checking against image/ should work.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Copy link

stackblitz bot commented Dec 10, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

ArnaudBarre
ArnaudBarre previously approved these changes Dec 10, 2023
packages/vite/src/node/server/middlewares/htmlFallback.ts Outdated Show resolved Hide resolved
Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

I think it was intentional that the html fallback also apply to images, especially when we removed the dot rule. Perhaps we could special case for favicon.ico only? cc @sapphi-red

@sapphi-red
Copy link
Member

Yeah, if */* is included, we have to treat the same with text/html. I think a special case for favicon.ico makes sense. We already have a similar check here.

const knownIgnoreList = new Set(['/', '/favicon.ico'])

@patak-dev
Copy link
Member Author

Thanks! Updated to directly avoid the default /favicon.ico request.

@patak-dev patak-dev added the p3-minor-bug An edge case that only affects very specific usage (priority) label Dec 12, 2023
@patak-dev patak-dev merged commit c902545 into main Dec 12, 2023
15 checks passed
@patak-dev patak-dev deleted the fix/html-fallback-for-favicon branch December 12, 2023 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants