Don't cache redirects

This commit is contained in:
Valentin Brandl 2019-08-07 20:57:23 +02:00
parent 9ae990e9c8
commit 2778b3ac84
No known key found for this signature in database
GPG Key ID: 30D341DD34118D7D
2 changed files with 12 additions and 1 deletions

View File

@ -80,6 +80,10 @@ fn redirect<T: Service>(
LOCATION,
T::redirect_url(&data.user, &data.repo, &head, &data.file).as_str(),
)
.set(CacheControl(vec![
CacheDirective::Public,
CacheDirective::MaxAge(0),
]))
.finish()
}));
}

View File

@ -4,7 +4,10 @@ use crate::{
statics::{load_env_var, GITHUB_AUTH_QUERY, OPT},
};
use actix_web::{
http::{header::LOCATION, StatusCode},
http::{
header::{CacheControl, CacheDirective, LOCATION},
StatusCode,
},
web, Error, HttpResponse,
};
use awc::{error::PayloadError, Client, ClientResponse};
@ -268,6 +271,10 @@ impl Service for GitLab {
)
.as_str(),
)
.set(CacheControl(vec![
CacheDirective::Public,
CacheDirective::MaxAge(0),
]))
.finish()
})
.from_err(),