Skip to content

Commit

Permalink
Add x_accel_expires pragma to set X-Accel-Expires header
Browse files Browse the repository at this point in the history
This allows us to have an nginx proxy cache responses for a different
length of time than the end client will based on the Cache-Control
header. For details see:

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_valid
  • Loading branch information
jonjensen committed Jan 16, 2018
1 parent b18828b commit 6157e62
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/Vend/Server.pm
@@ -1,6 +1,6 @@
# Vend::Server - Listen for Interchange CGI requests as a background server
#
# Copyright (C) 2002-2016 Interchange Development Group
# Copyright (C) 2002-2018 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
#
# This program was originally based on Vend 0.2 and 0.3
Expand All @@ -24,7 +24,7 @@
package Vend::Server;

use vars qw($VERSION $Has_JSON $RUNDIR);
$VERSION = '2.108';
$VERSION = '2.109';

use Cwd;
use POSIX qw(setsid strftime);
Expand Down Expand Up @@ -643,6 +643,9 @@ sub get_cache_headers {
my $cc = $::Pragma->{cache_control};
push @headers, "Cache-Control: $cc" if $cc;

my $xee = $::Pragma->{x_accel_expires};
push @headers, "X-Accel-Expires: $xee" if defined($xee) and length($xee);

push @headers, "Pragma: no-cache" if delete $::Scratch->{mv_no_cache};

return @headers;
Expand Down

0 comments on commit 6157e62

Please sign in to comment.