Comments (8)
Hello, and very sorry for that! I used an example from the readme to add that option to and request a dotfile and got a 403. Also our test suite (https://github.com/expressjs/serve-static/blob/master/test/test.js) also shows a 403. So there must be some weried edge case you are encountering I cannot figure out.
Can you provide all of the following so I can reproduce and determine the issue?
- Version of Node.js you are using
- Version of this module you are using
- A complete app that I can run without modification that will allow me to reproduce. Any modules besides this one used be sure to include their exact versions
- The exact path to the dotfile so I can recreate it for the app
- The http request to make against the app that shows a 404 instead of expected 403
Thank you!
from serve-static.
Hi
thank you very mush for answering me i really appriciate that 👍
1- node version is v18.12.1
2-express version is 4.16.1
3-server-static version is 1.15.0
4-https://gist.github.com/mina20088/621d2cb80c0a0b8f44e7686ef1237a86 this is a link to the app but there are some files that needs to be createed as public folder
5- and that is part of the code which contain the request to access a startic file
app.use(express.static('public',{ 'dotfiles' : 'deny', 'etag' : true, 'fallthrough' : true, immutable: false, maxAge:2300 }));
app.use(express.static('public/javascript',{ 'dotfiles' : 'deny', 'etag' : true, 'fallthrough' : true, immutable: true, maxAge:2300 }))
if you dont mind create the public folder and create the .env file inside it
if there are any other information please send me
from serve-static.
Thank you. The code there is a lot different from what you first posted. Specifically, fallthrough: true
means that when a file is not served (through any error, even the 403s) the error will not be sent and instead the request moves to the next spot. If you want the 403s you need to turn fallthrough
off to allow serve-static
to send back errors regarding unable to load files.
from serve-static.
Sorry, didn't mean to close this. I still need to test your example.
from serve-static.
no problem thank you that you answered in all cases
from serve-static.
by the way i tried it know and it works as you said the fallthrought needs to be false in order to get the error message on the screen think it is workin know
from serve-static.
I think this can be closed now right?
from serve-static.
solved
from serve-static.
Related Issues (20)
- how to prevent a file from being served HOT 2
- Add option to remove trailing slashes, as opposed to adding them HOT 9
- Support gzip static serving HOT 8
- Please add types for typescript HOT 1
- FR: Ability to always call next() HOT 8
- Extensions vs Directory HOT 1
- feature request: enable mapping url to a different file via a callback HOT 1
- Question: Is it possible to access the origin from setHeaders()? HOT 4
- Issue with Example Code HOT 4
- Make 'immutable' cache-control value HTTP/3 QPACK compatible HOT 1
- Use seconds instead of milliseconds for maxAge HOT 2
- setHeaders: need to access req.query HOT 2
- Corrupted file served if file is changed during serving. HOT 4
- Omitted `Content-Type` header when passing index file HOT 2
- Angular 13 SSR serve is failing with error - TypeError: Right-hand side of 'instanceof' is not an object HOT 5
- How to disable range requests in Next.js ? HOT 1
- Cannot use namespace 'HttpError' as a type HOT 2
- When the index is set to false, requests ending with / are being served with the content type header set to application/octet-stream instead of actual file's content type HOT 4
- error TS2688: Cannot find type definition file for 'mime'. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serve-static.