Add anticaching headers
This commit is contained in:
parent
603e741753
commit
4f6cc00fe6
1 changed files with 7 additions and 1 deletions
|
@ -23,7 +23,11 @@ use hyper::{
|
||||||
Post,
|
Post,
|
||||||
Put,
|
Put,
|
||||||
StatusCode,
|
StatusCode,
|
||||||
header::ContentType,
|
header::{
|
||||||
|
CacheControl,
|
||||||
|
CacheDirective,
|
||||||
|
ContentType
|
||||||
|
},
|
||||||
server::{Http, Request, Response, Service}
|
server::{Http, Request, Response, Service}
|
||||||
};
|
};
|
||||||
use webmetro::{
|
use webmetro::{
|
||||||
|
@ -99,11 +103,13 @@ impl Service for RelayServer {
|
||||||
Response::new()
|
Response::new()
|
||||||
.with_header(ContentType("video/webm".parse().unwrap()))
|
.with_header(ContentType("video/webm".parse().unwrap()))
|
||||||
.with_header(XAccelBuffering("no".to_string()))
|
.with_header(XAccelBuffering("no".to_string()))
|
||||||
|
.with_header(CacheControl(vec![CacheDirective::NoCache, CacheDirective::NoStore]))
|
||||||
},
|
},
|
||||||
(Get, "/live") => {
|
(Get, "/live") => {
|
||||||
Response::new()
|
Response::new()
|
||||||
.with_header(ContentType("video/webm".parse().unwrap()))
|
.with_header(ContentType("video/webm".parse().unwrap()))
|
||||||
.with_header(XAccelBuffering("no".to_string()))
|
.with_header(XAccelBuffering("no".to_string()))
|
||||||
|
.with_header(CacheControl(vec![CacheDirective::NoCache, CacheDirective::NoStore]))
|
||||||
.with_body(self.get_stream())
|
.with_body(self.get_stream())
|
||||||
},
|
},
|
||||||
(Post, "/live") | (Put, "/live") => {
|
(Post, "/live") | (Put, "/live") => {
|
||||||
|
|
Loading…
Reference in a new issue