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

Hosting with dotnet #527

Open
Hugos68 opened this issue Dec 11, 2023 · 2 comments
Open

Hosting with dotnet #527

Hugos68 opened this issue Dec 11, 2023 · 2 comments

Comments

@Hugos68
Copy link

Hugos68 commented Dec 11, 2023

When hosting via dotnet and using the app.UseStaticFiles() you require to add:

var provider = new FileExtensionContentTypeProvider();
provider.Mappings[".pagefind"] = "application/wasm";
provider.Mappings[".pf_meta"] = "application/wasm";
provider.Mappings[".pf_index"] = "application/wasm";
provider.Mappings[".pf_fragment"] = "application/wasm";
app.UseStaticFiles(new StaticFileOptions
{
    ContentTypeProvider = provider
});

Otherwise dotnet will recognize those files as "unknown" and therefor not serve them and return a 404 instead.

Do with this information whatever you think is appropiate but wanted to document it somewhere for future visitors.

@bglw
Copy link
Contributor

bglw commented Jan 6, 2024

Thank you @Hugos68 ! I will get this on the website soon.

@Karlstens
Copy link

Can confirm, I also experienced an issue with the current version of PageFind. The PageFind search for my VitePress project hosted via CPanel worked out of the box, whilst the same build hosted on Windows IIS needed MIME types added as "application/wasm" (application/octet-stream also worked... but changed to wasm after reading this post ) for the following extensions;

.pagefind
.pf_meta
.pf_index
.pf_fragment

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

No branches or pull requests

3 participants