Skip to content

path ignored for unversioned files #36

@benmccann

Description

@benmccann

I include staticify like this:

const staticify = require('staticify')(path.join(__dirname, 'public'), { pathPrefix: '/public' });
app.use('/public', staticify.middleware);

This works when I receive requests for versioned files, but not if I request the file without including the hash

I can work around the issue using the code below, but it'd be nice if staticify.middleware did this for me

    if (!isProd) {    
        app.use(function(req, res, next) {
            if (req.url.startsWith('/javascripts') || req.url.startsWith('/css')) {
                req.url = '/public/' + req.url;
            }
            next();
        });
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions