From 4f6cc00fe647bd311d00a8a4cb53ab08f20a04f9 Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Thu, 26 Apr 2018 02:19:14 -0400 Subject: [PATCH] Add anticaching headers --- src/commands/relay.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/commands/relay.rs b/src/commands/relay.rs index 71016df..30a3b0b 100644 --- a/src/commands/relay.rs +++ b/src/commands/relay.rs @@ -23,7 +23,11 @@ use hyper::{ Post, Put, StatusCode, - header::ContentType, + header::{ + CacheControl, + CacheDirective, + ContentType + }, server::{Http, Request, Response, Service} }; use webmetro::{ @@ -99,11 +103,13 @@ impl Service for RelayServer { Response::new() .with_header(ContentType("video/webm".parse().unwrap())) .with_header(XAccelBuffering("no".to_string())) + .with_header(CacheControl(vec![CacheDirective::NoCache, CacheDirective::NoStore])) }, (Get, "/live") => { Response::new() .with_header(ContentType("video/webm".parse().unwrap())) .with_header(XAccelBuffering("no".to_string())) + .with_header(CacheControl(vec![CacheDirective::NoCache, CacheDirective::NoStore])) .with_body(self.get_stream()) }, (Post, "/live") | (Put, "/live") => {