1.0.1 • Published 4 years ago

@snkattck/ririd v1.0.1

Weekly downloads
-
License
GPL-3.0-or-later
Repository
github
Last release
4 years ago

ririd

A simple 301 redirector.

Install this module.

Install

npm install

Configure

Create a config/default.json.

{
    "defaultRedirect": "https://hmdc.harvard.edu",
    "redirectMap": [
        { "src": "^(.*)?jots\\.pub$", "dst": "https://techscience.org" }
    ]
}

In the configuration above, non-matching requests are redirected to hmdc.harvard.edu.

Any request which matches the regex in the src attribute defined in the list redirectMap is redirected to dst

Query stringg and paths are automatically appended to destination hostname.

You can turn either off by specifying

{
    "defaultRedirect": "https://hmdc.harvard.edu",
    "redirectMap": [
        {
            "src": "^(.*)?jots\\.pub$", 
            "dst": "https://techscience.org",
            "withPath": false,
            "withQs": false
        }
    ]
}

Run

npm start