Skip to content

Commit

Permalink
Merge pull request #2003 from kareila/media-headers
Browse files Browse the repository at this point in the history
additional headers for media file requests
  • Loading branch information
zorkian committed Feb 22, 2017
2 parents ecba2a8 + 7400b91 commit 8410894
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions cgi-bin/DW/Controller/Media.pm
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ sub media_handler {
unless defined $dataref && ref $dataref eq 'SCALAR';

# now we're done!
$r->set_last_modified( $obj->{logtime} ) if $obj->{logtime};
$r->content_type( $obj->mimetype );
$r->print( $$dataref );
return $r->OK;
Expand Down
7 changes: 7 additions & 0 deletions cgi-bin/DW/Routing.pm
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,13 @@ sub _call_hash {
$r->content_type( $default_content_types->{$format} )
if $default_content_types->{$format};

# apply default cache-avoidant settings to "journal" content
# (similar to the behavior of our Apache server modules)
# so that proxies (e.g. Cloudflare) must revalidate the response
if ( $opts->role eq 'user' && ! $opts->no_cache ) {
$r->header_out( "Cache-Control" => "private, proxy-revalidate" );
}

# apply no-cache if needed
$r->no_cache if $opts->no_cache;

Expand Down

0 comments on commit 8410894

Please sign in to comment.