2013-01-27 3 views
1

우리는 node.js/express 응용 프로그램을 stunnel에 연결하여 ssl 종료를 수행합니다. 보안 세션 쿠키를 강제하는 방법을 알아낼 수 없습니다. 세션 미들웨어 소스에서 찾고 :node.js에서 req.connection.proxySecure를 설정하는 방법/stunnel 뒤에서 응용 프로그램을 연결하는 방법

// only send secure session cookies when there is a secure connection. 
    // proxySecure is a custom attribute to allow for a reverse proxy 
    // to handle SSL connections and to communicate to connect over HTTP that 
    // the incoming connection is secure. 
    var secured = cookie.secure && (req.connection.encrypted || req.connection.proxySecure); 
    if (secured || !cookie.secure) { 
     res.setHeader('Set-Cookie', cookie.serialize(key, req.sessionID)); 
    } 

나는 분명히 true로 req.connection.proxySecure을 설정해야합니다,하지만 난 그렇게하는 방법을 모르겠어요. stunnel이 "over HTTP"를 전달한다고 가정되지만 stunnel은 헤더를 설정할 수 없습니다. 그래서 나는 상실감에 처해있다. 대신 세션 미들웨어 전에 미들웨어의 사용자 정의 비트 또는 어딘가에 연결 구성 변수에서 로컬로 설정해야합니까? 어떤 도움

답변

1

프록시가 X-Forwarded-Proto: https 헤더를 설정되어 있는지 확인을위한

감사합니다. 그런 다음 proxy:true 구성 매개 변수를 세션 미들웨어에 추가해야합니다.

관련 문제