Giter VIP home page Giter VIP logo

Comments (21)

c-bertran avatar c-bertran commented on May 25, 2024 1

I was busy with my company, so I couldn't reply first.

I've modified the code to be even closer to Node's errors, and after a lot of testing, especially on node_modules of several GB and under Debian, Windows 11 and MacOs 13, non-existent files and folders always return a 404.
I'll be releasing the patched version in a few minutes, so let me know if the error persists.

from express-autoindex.

c-bertran avatar c-bertran commented on May 25, 2024 1

thank you, I'll need a few hours to debug.

from express-autoindex.

c-bertran avatar c-bertran commented on May 25, 2024 1

First of all, this is excellent news for 500 errors.
For the encoding errors I think I know why, it will take me a little time to correct the encoding errors are always longer.

As for the endpoints, I'll get to them as a matter of urgency - they're a pretty annoying bug.

I'm going to close this issue, I've opened one on new errors.

Thanks again for your patience

from express-autoindex.

c-bertran avatar c-bertran commented on May 25, 2024

from express-autoindex.

sefinek24 avatar sefinek24 commented on May 25, 2024

Thanks for your answer

When does this error occur?

(polish timezone)

0|blocklis | 14:56:40.356 15.07.2023: Error: Not Found
0|blocklis |     at n.error (/home/ubuntu/node/www/Sefinek-Blocklist-Collection/node_modules/express-autoindex/dist/index.cjs.js:1:1793)
0|blocklis |     at /home/ubuntu/node/www/Sefinek-Blocklist-Collection/node_modules/express-autoindex/dist/index.cjs.js:1:2327
0|blocklis | 14:57:05.359 15.07.2023: Error: Not Found
0|blocklis |     at n.error (/home/ubuntu/node/www/Sefinek-Blocklist-Collection/node_modules/express-autoindex/dist/index.cjs.js:1:1793)
0|blocklis |     at /home/ubuntu/node/www/Sefinek-Blocklist-Collection/node_modules/express-autoindex/dist/index.cjs.js:1:2327
0|blocklis | 15:00:52.321 15.07.2023: Error: Not Found
0|blocklis |     at n.error (/home/ubuntu/node/www/Sefinek-Blocklist-Collection/node_modules/express-autoindex/dist/index.cjs.js:1:1793)
0|blocklis |     at /home/ubuntu/node/www/Sefinek-Blocklist-Collection/node_modules/express-autoindex/dist/index.cjs.js:1:2327
0|blocklis | 15:11:17.795 15.07.2023: Error: Not Found
0|blocklis |     at n.error (/home/ubuntu/node/www/Sefinek-Blocklist-Collection/node_modules/express-autoindex/dist/index.cjs.js:1:1793)
0|blocklis |     at /home/ubuntu/node/www/Sefinek-Blocklist-Collection/node_modules/express-autoindex/dist/index.cjs.js:1:2327
0|blocklis | 15:21:46.046 15.07.2023: Error: Not Found
0|blocklis |     at n.error (/home/ubuntu/node/www/Sefinek-Blocklist-Collection/node_modules/express-autoindex/dist/index.cjs.js:1:1793)
0|blocklis |     at /home/ubuntu/node/www/Sefinek-Blocklist-Collection/node_modules/express-autoindex/dist/index.cjs.js:1:2327

Every few minutes, this error appears when the client sends GET requests to statically served files.

Is the error regularly obtained or not?

Yes

My source code:
https://github.com/sefinek24/Sefinek-Blocklist-Collection/blob/ce6c9bc5b48da66f66e53f36e9ace10302637515/server.js#L44
https://github.com/sefinek24/Sefinek-Blocklist-Collection/blob/ce6c9bc5b48da66f66e53f36e9ace10302637515/server.js#L45

from express-autoindex.

c-bertran avatar c-bertran commented on May 25, 2024

from express-autoindex.

sefinek24 avatar sefinek24 commented on May 25, 2024

Thank you @c-bertran, it would be great to eliminate this error as the requests ultimately end up with a 500 error.

0|blocklist  | 16:00:46.956 15.07.2023: [500 GET 2.518 ms] /generated/0.0.0.0/malicious-sites.txt - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36
0|blocklist  | 16:00:46.982 15.07.2023: Error: Not Found
0|blocklist  |     at n.error (/home/ubuntu/node/www/Sefinek-Blocklist-Collection/node_modules/express-autoindex/dist/index.cjs.js:1:1793)
0|blocklist  |     at /home/ubuntu/node/www/Sefinek-Blocklist-Collection/node_modules/express-autoindex/dist/index.cjs.js:1:2327
0

from express-autoindex.

c-bertran avatar c-bertran commented on May 25, 2024

I've just gone through the whole code again.
I've decided to implement a much more advanced error handling system than the original one. Depending on the type of error, the status code of the response is set to a specific code. Non-existent files or folders now point to 404 errors regardless of type. Other error code are possible but are much rarer.
I've also decided to add more information to the error output if the environment is not in production.

The new version is 1.1.1

I've tried this on several fairly brutal unit tests and I can't get this bug anymore. Nevertheless, if it comes back from your side, I'll keep on correcting the bug based on your source code directly.

Thank you again for trusting me and for your patience.

from express-autoindex.

c-bertran avatar c-bertran commented on May 25, 2024

I've just reworked the error handling a bit, and the most important thing is to explain how it's handled in the README.

I've also added the production mode, which makes it possible to have error messages that are much less explanatory for security reasons, and vice versa.

Is it now working properly on your side @sefinek24 ?

from express-autoindex.

sefinek24 avatar sefinek24 commented on May 25, 2024

I'll check this today,
Sorry for the long wait for a response

from express-autoindex.

sefinek24 avatar sefinek24 commented on May 25, 2024

Hello again @c-bertran. I've checked the latest version, and from now on, every request to a non-existing static file results in a 500 error. Could you please fix this? Or provide an option to disable it?

0|blocklist  | 19:26:34.833 19.07.2023: [500 GET 1.123 ms] /generated/example - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36
0|blocklist  | 19:26:34.839 19.07.2023: Error: No such file or directory
0|blocklist  | β†’ (ENOENT: no such file or directory, stat '/home/ubuntu/node/www/Sefinek-Blocklist-Collection/blocklist/generated/example')
0|blocklist  |     at o.error (/home/ubuntu/node/www/Sefinek-Blocklist-Collection/node_modules/express-autoindex/dist/index.cjs.js:1:2864)
0|blocklist  |     at /home/ubuntu/node/www/Sefinek-Blocklist-Collection/node_modules/express-autoindex/dist/index.cjs.js:1:3502
0|blocklist  | 19:28:14.479 19.07.2023: [200 GET 1.682 ms] /generated/0.0.0.0/forks/neodevpro.neodevhost.txt - Go-http-client/1.1

from express-autoindex.

c-bertran avatar c-bertran commented on May 25, 2024

It's really strange, in my case it's 404 requests that come out, not 500. I'll run the tests again in an hour when I get home from work.
I'll try my unit tests on your project.

from express-autoindex.

sefinek24 avatar sefinek24 commented on May 25, 2024

Okay no problem πŸ‘ (:

from express-autoindex.

sefinek24 avatar sefinek24 commented on May 25, 2024

f6a3b518a1c3152911b4808411a3be5e

from express-autoindex.

c-bertran avatar c-bertran commented on May 25, 2024

The new version 1.1.3 is out, and if the error persists, I honestly can't understand it.

from express-autoindex.

sefinek24 avatar sefinek24 commented on May 25, 2024

something went wrong >:

PS C:\GitHub\Sefinek-Blocklist-Collection> node .
App listening at http://127.0.0.1:5916
MongoDB connected successfully!
Connected to the database
[200 GET 33.299 ms] / - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
[200 GET 3.242 ms] /css/style.css - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
[404 GET 8.686 ms] /favicon.ico - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
[200 GET 3.359 ms] /generated - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
[404 GET 7.578 ms] /generatedg - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
[404 GET 9.170 ms] /generatedg - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
[304 GET 2.148 ms] /generated - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
[200 GET 3.414 ms] /generated/noip - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
[200 GET 2.319 ms] /generated/noip/apps - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
[500 GET 1.863 ms] /generated/noip/apps/example - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
Error: No such file or directory
β†’ (ENOENT: no such file or directory, stat 'C:\GitHub\Sefinek-Blocklist-Collection\blocklist\generated\noip\apps\example')
    at o.error (C:\GitHub\Sefinek-Blocklist-Collection\node_modules\express-autoindex\dist\index.cjs.js:1:3695)
    at C:\GitHub\Sefinek-Blocklist-Collection\node_modules\express-autoindex\dist\index.cjs.js:1:4333
[500 GET 0.982 ms] /generated/noip/apps/example - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
Error: No such file or directory
β†’ (ENOENT: no such file or directory, stat 'C:\GitHub\Sefinek-Blocklist-Collection\blocklist\generated\noip\apps\example')
    at o.error (C:\GitHub\Sefinek-Blocklist-Collection\node_modules\express-autoindex\dist\index.cjs.js:1:3695)
    at C:\GitHub\Sefinek-Blocklist-Collection\node_modules\express-autoindex\dist\index.cjs.js:1:4333
[304 GET 1.511 ms] /generated - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
[304 GET 1.353 ms] /generated - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
[404 GET 7.067 ms] /generatedtestt - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
[404 GET 6.487 ms] /generatedtestt/test1/1 - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
[404 GET 6.615 ms] /generatedtestt/test1/1/1/1/1/1/1/1 - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
[404 GET 7.538 ms] /generatedtestt/test1/1/1/1/1/1/1/exampleeeeeeee - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
[200 GET 21.428 ms] / - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
[304 GET 0.825 ms] /css/style.css - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
[304 GET 1.481 ms] /generated - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
[200 GET 3.922 ms] /generated/127.0.0.1 - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
[200 GET 2.285 ms] /generated/127.0.0.1/ads - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
[500 GET 0.788 ms] /generated/127.0.0.1/ads/example - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
Error: No such file or directory
β†’ (ENOENT: no such file or directory, stat 'C:\GitHub\Sefinek-Blocklist-Collection\blocklist\generated\127.0.0.1\ads\example')
    at o.error (C:\GitHub\Sefinek-Blocklist-Collection\node_modules\express-autoindex\dist\index.cjs.js:1:3695)
    at C:\GitHub\Sefinek-Blocklist-Collection\node_modules\express-autoindex\dist\index.cjs.js:1:4333
[500 GET 0.673 ms] /generated/127.0.0.1/ads/example.txt - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
Error: No such file or directory
β†’ (ENOENT: no such file or directory, stat 'C:\GitHub\Sefinek-Blocklist-Collection\blocklist\generated\127.0.0.1\ads\example.txt')
    at o.error (C:\GitHub\Sefinek-Blocklist-Collection\node_modules\express-autoindex\dist\index.cjs.js:1:3695)
    at C:\GitHub\Sefinek-Blocklist-Collection\node_modules\express-autoindex\dist\index.cjs.js:1:4333
[200 GET 1.705 ms] /generated/127.0.0.1/ads/ - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
[500 GET 0.917 ms] /generated/ddd - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
Error: No such file or directory
β†’ (ENOENT: no such file or directory, stat 'C:\GitHub\Sefinek-Blocklist-Collection\blocklist\generated\ddd')
    at o.error (C:\GitHub\Sefinek-Blocklist-Collection\node_modules\express-autoindex\dist\index.cjs.js:1:3695)
    at C:\GitHub\Sefinek-Blocklist-Collection\node_modules\express-autoindex\dist\index.cjs.js:1:4333
[500 GET 0.875 ms] /generated/11/111 - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
Error: No such file or directory
β†’ (ENOENT: no such file or directory, stat 'C:\GitHub\Sefinek-Blocklist-Collection\blocklist\generated\11\111')
    at o.error (C:\GitHub\Sefinek-Blocklist-Collection\node_modules\express-autoindex\dist\index.cjs.js:1:3695)
    at C:\GitHub\Sefinek-Blocklist-Collection\node_modules\express-autoindex\dist\index.cjs.js:1:4333

from express-autoindex.

c-bertran avatar c-bertran commented on May 25, 2024

To understand the bug I'm going to need your code

from express-autoindex.

sefinek24 avatar sefinek24 commented on May 25, 2024

sefinek24/Sefinek-Blocklist-Collection@2f346f8

Okayy

from express-autoindex.

c-bertran avatar c-bertran commented on May 25, 2024

I've just found the origin of the bug, it's pretty tricky but correctable. I'm going to take advantage of this as I'm going to modify several things to add the possibility of creating your own page template.

from express-autoindex.

c-bertran avatar c-bertran commented on May 25, 2024

I've just released version 1.3.0 of the lib @sefinek24 .
The bug should be fixed, and I've added the ability to create your own HTML page, custom Date format and JSON object.
I've also added another option for 4xx errors to throw an error, which may be useful in certain very specific cases.

I hope this time it will be good ^^

from express-autoindex.

sefinek24 avatar sefinek24 commented on May 25, 2024

Thank you @c-bertran for your effort put into fixing this. I really appreciate it and thank you. Error 500 has been fixed, but unfortunately, a few new errors have appeared now.

  1. In the express-autoindex@^1.3.0 version, the character encoding for static files has stopped working correctly.

test.txt file encoding: UTF-8 without BOM

  1. Endpoints like /xxx/yyy/zzz/generated do not work with express-autoindex, even though they are correctly served statically.

Thank you also for adding the customTemplate option! There is no other npm module like yours, so I plan to use it anyway - even if it doesn't work perfectly 100%.

from express-autoindex.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.