add cache-control header for ajax request to by-pass proxy cache

This commit is contained in:
Dapeng 2016-09-21 14:10:58 +08:00
parent 4e64a0b529
commit 00397136b5
2 changed files with 12 additions and 1 deletions

View file

@ -2,6 +2,12 @@ package org.springframework.samples.petclinic;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.ui.ModelMap;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.context.request.WebRequestInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@SpringBootApplication
public class PetClinicApplication {
@ -10,3 +16,4 @@ public class PetClinicApplication {
SpringApplication.run(PetClinicApplication.class, args);
}
}

View file

@ -4,7 +4,11 @@ var petClinicApp = angular.module('petClinicApp', [
'ngRoute', 'layoutNav', 'layoutFooter', 'layoutWelcome',
'ownerList', 'ownerDetails', 'ownerForm', 'petForm', 'visits', 'vetList']);
petClinicApp.config(['$locationProvider', '$routeProvider', function ($locationProvider, $routeProvider) {
petClinicApp.config(['$locationProvider', '$routeProvider', '$httpProvider', function(
$locationProvider, $routeProvider, $httpProvider) {
// safari turns to be lazy sending the Cache-Control header
$httpProvider.defaults.headers.common["Cache-Control"] = 'no-cache';
$locationProvider.hashPrefix('!');