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 content type issue #3424

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

ramondeklein
Copy link
Collaborator

When the application returns index.html, it should always use Content-Type: text/html to ensure that the returned HTML is rendered. It previously used the MIME-type that was derived from the extension, which may cause erratic behaviour for some extensions.

Although http.ServeContent detects the content automatically, based on the extension we do need to set Content-Type: text/html explicitly. The http.FileServer is kind of crap, because you can't provide special handling for the (pretty common) scenario that the file can't be found. This is solved by intercepting some calls (via the notFoundRedirectRespWr type), but this doesn't prevent that the response headers are already prepared. That's why we need to set the content-type back to HTML again.

I also changed the logic, so the SPA file-server application is generated only once.

IMPORTANT: This issue doesn't occur when running via yarn start. Run make build-static to update the local front-end, rebuild and start the back-end and connect via http://localhost:8444/ to reproduce the issue.

@ramondeklein ramondeklein self-assigned this Aug 12, 2024
Copy link
Contributor

@bayasdev bayasdev left a comment

Choose a reason for hiding this comment

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

LGTM

@ramondeklein ramondeklein enabled auto-merge (squash) August 12, 2024 17:21
@ramondeklein ramondeklein merged commit 8d13be5 into minio:master Aug 13, 2024
33 checks passed
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