第086讲 http协议深度剖析③-http响应详解(禁用缓存设置)

image

Refresh :网页延时跳转

<?php
    //header("Refresh:3;url=http://www.baidu.com");
    header("Refresh:3;url=http://localhost/083.php");
?>

抓包数据:抓的是http://localhost/086_refresh.php

Request URL:http://localhost/086_refresh.php
Request Method:GET
Status Code:200 OK (from disk cache)
Remote Address:[::1]:80
Response Headers
Content-Length:0
Content-Type:text/html
Date:Fri, 14 Apr 2017 04:29:36 GMT
Refresh:3;url=http://localhost/083.php
Server:Apache/2.4.10 (Win32) OpenSSL/0.9.8zb mod_fcgid/2.3.9
X-Powered-By:PHP/5.4.33
Request Headers
Provisional headers are shown
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

跳转到页面抓包http://localhost/083.php

Request URL:http://localhost/083.php
Request Method:GET
Status Code:200 OK
Remote Address:[::1]:80
Response Headers
view source
Connection:Keep-Alive
Content-Type:text/html
Date:Fri, 14 Apr 2017 04:31:10 GMT
Keep-Alive:timeout=5, max=100
Server:Apache/2.4.10 (Win32) OpenSSL/0.9.8zb mod_fcgid/2.3.9
Transfer-Encoding:chunked
X-Powered-By:PHP/5.4.33
Request Headers
view source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate, sdch, br
Accept-Language:zh-CN,zh;q=0.8,en;q=0.6
Connection:keep-alive
Host:localhost
Referer:http://localhost/086_refresh.php
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

禁用浏览器缓存:

<?php
//通过header来禁用缓存(ajax)
    header("Expires:-1");
    header("Cache-Control:no_cache");
    header("");
    //上边写的那些是为了兼容浏览器禁用缓存的
    echo "hello cache";
?>

抓包看效果:

General:

Request URL:http://localhost/086_nocache.php
Request Method:GET
Status Code:200 OK
Remote Address:[::1]:80

Response Headers

HTTP/1.1 200 OK
Date: Fri, 14 Apr 2017 08:40:46 GMT
Server: Apache/2.4.10 (Win32) OpenSSL/0.9.8zb mod_fcgid/2.3.9
X-Powered-By: PHP/5.4.33
Expires: -1
Cache-Control: no_cache
Pragma: no_cache
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html

Request Headers

GET /086_nocache.php HTTP/1.1
Host: localhost
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch, br
Accept-Language: zh-CN,zh;q=0.8,en;q=0.6

猜你喜欢

转载自blog.csdn.net/u014449096/article/details/80707155
今日推荐