From Tips for Writing Portable Node.js Code:

Bonus: Something that Breaks on Linux and Solaris!

Both Windows and, by default, OS X, use case-insensitive file systems. That means if you install a package named foo, any of require("foo") or require("FOO") or require("fOo") will work—on Windows and OS X. But then when you go to deploy your code, out of your development environment and into your Linux or Solaris production system, the latter two will not work! So it's a little thing, but make sure you always get your module and package name casing right. [emphasis mine -- mfn]

This is a problem when serving files by name with express' static middleware too. Argh. And check out this schmoe's problem, with a huge legacy php site migrating to Linux, from case insensitivity to case sensitive. Ouch. Can you imagine the tech debt there?

So what if you want to use Express to serve files from the filesystem on, I don't know, Ubuntu on linode [which uses ext4]? And what if you want folks to be able to access your privacy policy at both and

Even worse, what if you told your app reviewer to try and that meant they had to reject your app submission now that you've changed servers? /facepalm

From MarkUpDown - Review Results:

Locations: mumduwp1.4.0.0x86x64_arm.appxbundle

Tested OSes: Windows.Universal

Tested Devices: Acer Iconia W700

Notes To Developer

The privacy policy link did not resolve to a functional webpage.


I've never liked it when I've typed in a URL by hand and got a 404 because I had one or two letters in the wrong case. I mean, it makes sense that case sensitive file systems are easier to maintain. It's just an end-use-case pain when you're serving files.

But URL case in Edge is broken too... 🙄😱

And insult to injury? Microsoft Edge (Internet Explorer's replacement in Win10) "remembers" case when you retype a URL! What, wait? So I can't navigate to the "correctly cased" URL with Edge even if I want to -- and I wonder if I get the same reviewer(s) if this'll happen to them too.


How to fix it

How do you fix case sensitivity for express so that it's never a problem with ext4? Well, you could make everything in your filesystem lowercase, and then just always run request.url through .toLowerCase(). That seems pretty nuclear. Slightly better is to try the URL as requested first, and then do this...


When a file is not found, instead of sending a 404 response, this module will instead call next() to move on to the next middleware, allowing for stacking and fall-backs.

Still have to set the filesystem to a single case throughout, and then if you want to use mixed case in your URLs to make them easier to remember or what-have-you, you're creating a good deal of extra work for your server every time mixed case is used.

How bad is it to make your web server take a URL, not find it, then search the filesystem again for a lower cased version? It might be smarter/less work just to lowercase the string every time and ensure your filesystem is in sync. It has to be cheaper to lowercase the url every time than to hit express.static twice in 30+% of your requests, right? Kind of a pain when you're editing files and want to glance at human readable names, but I think that's the only other downside.

So I guess it looks like I get to go through and change the case of my website's files and folders to a single case. Right? Isn't that The Right Thing to do to approximate case insensitivity? Is it ever better for the end user to have a case sensitive http server? I don't think so. Seems unnecessarily processor churny and hacky to lower case the earth, but man, I hate case sensitivity for URLs.

That fishing metaphor that tells you I'm about to comprise my best intentions...

In any event, for now, I've decided to embarrassingly give the server a fish, I'm afraid.

if (req.originalUrl === "/privacy" || req.originalUrl === "/privacy/") {
    req.url = "/Privacy/";

That's probably worth a Unicode facepalm too.

I really enjoy using linode, though my needs are so small I might drop down to Digital Ocean's $5 a month plan if it's just as easy to administer. It's great having your own "box" on the net. So much more powerful than shared hosting. Feel like I was about a decade behind with hosts, but, boy, I'm caught up now. Wonder how long before I start using .NET Core on it...

Labels: , , , , ,