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

frontend: bypass auth middleware for favicon and icon assets in root #3240

Merged
merged 3 commits into from
Feb 26, 2025

Conversation

jecr
Copy link
Contributor

@jecr jecr commented Feb 26, 2025

Updated the ServeHTTP function in the assetHandler to add caching headers for .ico, .svg, and .webp files, serving these files with a Cache-Control header set to cache for one day.

This change bypasses the authentication middleware for favicon and icon assets in the root directory. The bypass is limited to image assets in the root path to maintain security.

Key changes:

  • Added early path check for image file extensions (.ico, .svg, .webp)
  • Added security check to only serve files from root directory
  • Set Cache-Control header to cache assets for 24 hours
  • Serve files directly without going through auth middleware

@jecr jecr requested a review from a team as a code owner February 26, 2025 16:30
@jecr jecr merged commit 06b282f into main Feb 26, 2025
8 checks passed
@jecr jecr deleted the fix-favicon-serving branch February 26, 2025 18:08
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.

3 participants