DDMAL / CantusDB

A new site for Cantus Database running under Django.
https://cantusdatabase.org
MIT License
5 stars 6 forks source link

Some redirects return `302` when they should probably return `301` #1110

Open dchiller opened 11 months ago

dchiller commented 11 months ago

In my excavations of the CantusDB logs, I discovered that responses to some requests that I think are permanent redirect are actually returning 302 responses.

In particular, /node/<id> and /office return 302's rather than 301's. My understanding is that both of these redirects are permanent for the purpose of harmonizing Old and NewCantus URLs.

jacobdgm commented 11 months ago

And 301 indicates a permanent redirect, correct?

We should be a bit careful - in something relating to DataLake earlier today, we were talking about renaming, say, /sources to /source. We've already switched /genre to redirect to /genres, so we should be careful not to swap things back and forth.

jacobdgm commented 11 months ago

Redirects that should be permanent, I think:

some which we may not be certain about:

dchiller commented 11 months ago

And 301 indicates a permanent redirect, correct?

Yes

jacobdgm commented 11 months ago

Looks like this will be trivial to implement once we're very confident of our list of permanent redirects. return redirect(reverse("csv-export", args=[source_id])) becomes return redirect(reverse("csv-export", args=[source_id]), permanent=True)

jacobdgm commented 6 months ago

Going to make an executive decision and say we're currently happy with all of our redirects, and that we should communicate that they are permanent. This will just require someone going through all the redirects in our views and adding a permanent=True kwarg.