do redirects using http 301

actix will instead use http 308, which is technically the more correct,
modern way to do this.

but http 308 isn't understood by some old browsers. today, 99.9% of
people wouldn't care about that. but i do.
This commit is contained in:
Gered 2023-07-02 13:58:10 -04:00
parent d98cef8af9
commit 7c1d42f870

View file

@ -3,6 +3,7 @@ use std::ops::Deref;
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::RwLock; use std::sync::RwLock;
use actix_web::http::StatusCode;
use actix_web::web::Redirect; use actix_web::web::Redirect;
use actix_web::{Either, HttpRequest, HttpResponse}; use actix_web::{Either, HttpRequest, HttpResponse};
use chrono::{Datelike, TimeZone}; use chrono::{Datelike, TimeZone};
@ -426,7 +427,7 @@ impl SiteService {
} }
Some(Content::Redirect(url)) => { Some(Content::Redirect(url)) => {
log::debug!("Found redirect at {}", req.path()); log::debug!("Found redirect at {}", req.path());
Some(Either::Right(Redirect::to(url).permanent())) Some(Either::Right(Redirect::to(url).using_status_code(StatusCode::MOVED_PERMANENTLY)))
} }
None => { None => {
log::debug!("No matching content at {}", req.path()); log::debug!("No matching content at {}", req.path());