首页   注册   登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
V2EX  ›  问与答

为什么我的 response header 里 connection:keep-alive,close, request header 里 connection:keep-alive

  •  
  •   shayang888 · 2018-11-05 17:29:42 +08:00 · 1370 次点击
    这是一个创建于 397 天前的主题,其中的信息可能已经有所发展或是发生改变。

    response header

    access-control-allow-credentials: true
    access-control-allow-origin: http://localhost:4200
    cache-control: no-cache, no-store
    connection: keep-alive, close
    content-type: application/json;charset=UTF-8
    date: Mon, 05 Nov 2018 09:26:16 GMT
    set-cookie: uInfo=$2a$10$vrLly47d7WPDH1386EvFEuaeaypaM.21qw8wi54Cz4V5PrvctTAvq; Max-Age=1800; Expires=Mon, 05-Nov-2018 09:56:16 GMT; Path=/; HttpOnly
    transfer-encoding: chunked
    vary: Origin, Access-Control-Request-Method, Access-Control-Request-Headers
    X-Powered-By: Express
    

    request header

    Accept: application/json, text/plain, */*
    Accept-Encoding: gzip, deflate, br
    Accept-Language: zh-CN,zh;q=0.9
    Connection: keep-alive
    Content-Length: 57
    Content-Type: application/json
    Cookie: SESSION=ZTc4MzI5NmUtMzczYy00YjQxLWEzMGQtZDkyMjNhODgyM2Nl
    DNT: 1
    Host: localhost:4200
    Origin: http://localhost:4200
    Referer: http://localhost:4200/login
    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36
    

    代码

    Cookie cookie = new Cookie("uInfo", uInfo);
    cookie.setMaxAge( httpSession.getMaxInactiveInterval());
    cookie.setPath("/");
    cookie.setHttpOnly(true);
    response.addCookie(cookie);
    response.addHeader("cache-control", "no-cache");
    response.addHeader("cache-control", "no-store");
    response.addHeader("connection", "keep-alive");
    
    目前尚无回复
    关于   ·   FAQ   ·   API   ·   我们的愿景   ·   广告投放   ·   感谢   ·   实用小工具   ·   2254 人在线   最高记录 5043   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.3 · 23ms · UTC 06:04 · PVG 14:04 · LAX 22:04 · JFK 01:04
    ♥ Do have faith in what you're doing.