npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rwserve-lowercase

v1.0.7

Published

RWSERVE plugin to conditionally convert the incoming request path to lowercase letters

Downloads

6

Readme

Open Source RWSERVE plugin

Lowercase

Probe file system for lowercase filename

Motivation

Filenames on Windows are case insensitive, so a request for Hello-World.html and hello-world.html are equivalent. Not so on Linux. These are recognized as two distinct files. Neither way is "right", but moving from one file system to another with names like this is problematic.

Because of this, it has become customary to restrict URL paths to be all lowercase. Websites that started out on a case insensitive file system and were later moved to a case-sensitive file system, may break when external hyperlinks point to the incorrectly cased filename. One solution is to rename all filenames to their lowercase equivalent, and use this plugin to instruct browsers of the change.

The algorithm is straightforward:

  1. Check the file system to see if the requested resource path exists; if so, skip the remaining steps and resume standard processing.

  2. Apply a lowercase filter to the full resource path and filename.

  3. Probe the file system to see if the lowercased version exists:

    • If so, return with 302 Found and a location header containing the correct resource path.
    • If not, return with 404 Not Found.

Customization

This plugin is open source and can be modified or enhanced to perform tasks such as these:

  • Safely reorganize the directory structure of your website, without unnecessarily breaking external links.
  • Define a lookup table with original filenames and archived filenames, where access to archived content is behind a paywall.

Download

The plugin module is available from NPM . Before proceeding, you should already have Node.js and RWSERVE configured and tested.

This module should be installed on your web server in a well-defined place, so that it can be discovered by RWSERVE. The standard place for public domain plugins is /srv/rwserve-plugins.

Configuration is Everything

Make the software available by declaring it in the plugins section of your configuration file. For detailed instructions on how to do this, refer to the plugins documentation on the Read Write Tools HTTP/2 Server website.

TL;DR

The sample router shown above will route all requests (*) for GET or HEAD methods, to the plugin.

Cookbook

A full configuration file with typical settings for a server running on localhost port 7443, is included in this NPM module at etc/lowercase-config. To use this configuration file, adjust these variables if they don't match your server setup:

Deployment

Once you've tested the plugin and are ready to go live, adjust your production web server's configuration in /etc/rwserve/rwserve.conf and restart it using systemd . . .

. . . then monitor its request/response activity with journald.

Prerequisites

This is a plugin for the Read Write Tools HTTP/2 Server, which works on Linux platforms.

Review

License

The rwserve-lowercase plugin is licensed under the MIT License.

Availability