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

Case-insensitive option #92

Open
jods4 opened this issue Jan 11, 2021 · 4 comments
Open

Case-insensitive option #92

jods4 opened this issue Jan 11, 2021 · 4 comments

Comments

@jods4
Copy link

jods4 commented Jan 11, 2021

Is it possible to add an option to make sirv case-insensitive?

That would probably mean making the normalized path lowercase in FILES and doing the same on incoming path.

Motivation
Currently on Windows sirv behaves differently in dev mode vs not, because in dev mode every request is a file system check, which is case-insensitive on Win.
When you run the same folder from sirv static cache, it becomes case-sensitive and some requests suddenly fail.

Also it is common for some (but not all) web servers to be case-insensitive.

lukeed added a commit that referenced this issue Dec 1, 2021
@lukeed
Copy link
Owner

lukeed commented Dec 1, 2021

As expected, this breaks Linux systems running sirv without caching enabled. My initial impression is that this may be too fussy to accommodate

@jods4
Copy link
Author

jods4 commented Dec 6, 2021

Without caching the implementation is a file probe, which is dependent on OS semantic (e.g. case-insensitive on Win, case-sensitive on Linux).

I agree that trying to change the OS semantics is a serious hassle.

What about just having an option to configure the cached behaviour?
The default value of this option could be set to the underlying OS behaviour, so that there's no discrepancy between dev and prod when running on the same OS.

It's not perfect as one cannot change the OS semantics without cache, but it's a nice improvement.
It improves consistency between dev/prod and enables new scenarios such as case-insensitive web server on Linux (with cache).

@lukeed
Copy link
Owner

lukeed commented Dec 27, 2021

How about options.insensitive or options.lowercase

@jods4
Copy link
Author

jods4 commented Dec 30, 2021

yeah it would do the job.
I'm not very good at naming things, myself 😕

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

2 participants