vercel/serve-handler

Incorrect 404 served for directories which have dots in the name

pavelgrinchenko opened this issue · 1 comments

Hi! We have such directories names in our static website /public/doc/changelog/0.18
And when serve-handler handles requests we have 404 for such pages.
I found reason - there is false-positive extname checking here https://github.com/zeit/serve-handler/blob/master/src/index.js#L610
But I'm not sure how it should be resolved. Maybe this check can follow next one (where handles cleanUrl)

Our config if it's important

serveHandler(req, res, {
    public: 'public',
    cleanUrls: true,
    trailingSlash: false,
    directoryListing: false,
    headers: [
      {
        source: '**/*.@(jpg|jpeg|gif|png)',
        headers: [
          {
            key: 'Cache-Control',
            value: 'max-age=86400'
          }
        ]
      },
      {
        source: '!**/*.@(jpg|jpeg|gif|png)',
        headers: [
          {
            key: 'Cache-Control',
            value: 'max-age=0'
          }
        ]
      }
    ]
  })

shameless self-promotion alert:
this feature is fixed in my @warren-bank/serve fork of serve