Skip to content

StaticFiles that return a 404 could use more diagnostic information #3123

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

Closed
Tratcher opened this issue May 7, 2018 · 2 comments
Closed
Labels
area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares feature-static-files

Comments

@Tratcher
Copy link
Member

Tratcher commented May 7, 2018

From @csharpfritz on May 5, 2018 16:36

A little diagnostic information when logging a 404 for a static file would be very helpful.

Perhaps adding something like "searched in folder '/app/wwwroot/lib/WHATEVER'" would be beneficial to help debug simple configuration errors

Copied from original issue: aspnet/KestrelHttpServer#2549

@Tratcher
Copy link
Member Author

Tratcher commented May 7, 2018

There is a debug log:
https://github.com/aspnet/StaticFiles/blob/afdb39309506711a60aaf6ac1a3216cf73989b4c/src/Microsoft.AspNetCore.StaticFiles/StaticFileMiddleware.cs#L89
https://github.com/aspnet/StaticFiles/blob/afdb39309506711a60aaf6ac1a3216cf73989b4c/src/Microsoft.AspNetCore.StaticFiles/LoggerExtensions.cs#L47-L50

It doesn't know the directory, that's abstracted via the IFileProvider.

Also, the static file middleware doesn't return 404's, it falls through and you only get a 404 if you reach the end of the pipeline without something handling it.

@shirhatti
Copy link
Contributor

Closing as this isn't actionable. We believe there is enough fidelity of information in the debug log.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
@amcasey amcasey added area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares and removed area-runtime labels Jun 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares feature-static-files
Projects
None yet
Development

No branches or pull requests

5 participants