expressjs / serve-static

Serve static files
MIT License
1.39k stars 228 forks source link

use 301 status code for directory redirects #59

Closed thestinger closed 8 years ago

thestinger commented 8 years ago

The 303 error code isn't really appropriate for this use case. It should be either a 301 (permanent) or a 302 (temporary). Using either 302 or 303 means that search engines won't pass along ranking to the target so it's lost. It also prevents caching of the redirect, which is done for 301. The cache can be invalidated by redirecting back from the target so it's harmless.

dougwilson commented 8 years ago

Hi @thestinger, it looks like I agree, 301 is a better code for the type of redirect that is being performed here. This module was extracted from the connect project, which is how it inherited the 303 code, for better or worse. I will absolutely merge this in with the 2.0 release!

dougwilson commented 8 years ago

We're going ahead and landing this in version 1.11.0