nginx缓存反向代理不缓存

时间:2017-09-05 07:02:28

标签: caching nginx

我有以下内容并且无效,因为我的请求未缓存。你能否找出问题所在?

GET /spaces/&content_type=login&locale=en HTTP/1.1
Host: localhost:4201
Connection: keep-alive
Accept: application/json, text/plain, */*
X-XSRF-TOKEN: 831a018f-7919-4db5-a97c-778a9f6c088e
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36
Referer: http://localhost:4201/en
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.8
Cookie: XSRF-TOKEN=831a018f-7919-4db5-a97c-778a9f6c088e; JSESSIONID=ECED92B3149D422AA6E26182498F2149; _gat=1; _ga=GA1.1.653346684.1497870993; _gid=GA1.1.720272175.1504510558
If-None-Match: W/"70fb2193558c29d410dd966b398d5357"

我的要求是:

HTTP/1.1 304 Not Modified
X-Powered-By: Express
access-control-allow-origin: *
server: nginx/1.10.2
date: Tue, 05 Sep 2017 06:57:40 GMT
connection: close
access-control-allow-headers: Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization,X-Contentful-Skip-Transformation,X-Contentful-User-Agent,X-Contentful-Enable-Experimental-Feature
access-control-allow-methods: GET,HEAD,OPTIONS
access-control-expose-headers: Etag
access-control-max-age: 1728000
cf-cache-name: content_delivery
cf-organization-id: 123456
cf-space-id: 456789
etag: W/"987654"
x-content-type-options: nosniff
x-contentful-request-id: 123456

响应:

  "/spaces" : {
    "target" : "https://cached-calls.domain.com",
    "secure": false,
    "changeOrigin": true,
    "pathRewrite": {
      "^/spaces/": "/spaces/spaceId/entries?access_token=accessToken"
    }
  }

使用此配置使用angular的代理从localhost代理到cached-calls.domain.com:

${1234}

0 个答案:

没有答案