You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by mi...@apache.org on 2017/03/21 16:17:36 UTC

[1/2] incubator-trafficcontrol git commit: [TC-203] Make /public static files cacheable

Repository: incubator-trafficcontrol
Updated Branches:
  refs/heads/master 0bd8d4faf -> 1af5663d2


[TC-203] Make /public static files cacheable


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/a9038eb9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/a9038eb9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/a9038eb9

Branch: refs/heads/master
Commit: a9038eb990dd90feae1ab3630417428a611393bf
Parents: 0bd8d4f
Author: Jan van Doorn <ja...@cable.comcast.com>
Authored: Tue Mar 21 09:54:34 2017 -0600
Committer: Jan van Doorn <ja...@cable.comcast.com>
Committed: Tue Mar 21 09:54:34 2017 -0600

----------------------------------------------------------------------
 traffic_ops/app/lib/TrafficOps.pm | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a9038eb9/traffic_ops/app/lib/TrafficOps.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/TrafficOps.pm b/traffic_ops/app/lib/TrafficOps.pm
index 2c5a1a0..b2aeca2 100644
--- a/traffic_ops/app/lib/TrafficOps.pm
+++ b/traffic_ops/app/lib/TrafficOps.pm
@@ -110,6 +110,15 @@ sub startup {
 	my $static = Mojolicious::Static->new;
 	push @{ $static->paths }, 'public';
 
+	# Make sure static files are cached
+	$self->hook(
+		after_static => sub {
+			my $self = shift;
+			$self->res->headers->cache_control('max-age=3600, must-revalidate')
+				if $self->res->code;
+		}
+	);
+
 	if ( $mode ne 'test' ) {
 		$access_control_allow_origin = $config->{'cors'}{'access_control_allow_origin'};
 		if ( defined($access_control_allow_origin) ) {


[2/2] incubator-trafficcontrol git commit: This closes #386

Posted by mi...@apache.org.
This closes #386


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/1af5663d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/1af5663d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/1af5663d

Branch: refs/heads/master
Commit: 1af5663d2c2c7f8729ef330bc165db22377910ca
Parents: a9038eb
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Tue Mar 21 10:17:34 2017 -0600
Committer: Jeremy Mitchell <mi...@gmail.com>
Committed: Tue Mar 21 10:17:34 2017 -0600

----------------------------------------------------------------------

----------------------------------------------------------------------