WordPress 프런트 엔드 사용자 로그인 양식의 문제를 해결하고 있습니다. 이 코드는 개발 서버의 동일한 사이트에서는 작동하지만 프로덕션 서버에서는 작동하지 않습니다.WordPress wp_signon() 성공했지만 응답 헤더에 쿠키가 첨부되지 않았습니다.
프로덕션 서버에서는 인증이 통과되고 wp_signon()은 전체 사용자 객체를 반환하지만 쿠키는 응답 스트림에 삽입되지 않습니다.
이HTTP/1.1 302 Found
Server: cloudflare-nginx
Date: Fri, 24 May 2013 07:53:01 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
X-Pingback: http://www.domain.com/blog/xmlrpc.php
X-Frame-Options: SAMEORIGIN
Location: http://www.domain.com/log-in/
Vary: Accept-Encoding,User-Agent
X-Cacheable: YES:FORCED
X-Varnish: 1753703763
Age: 0
Via: 1.1 varnish
X-Cache: MISS
CF-RAY: 73868e9b8da0418
Content-Length: 802
object(WP_User)#329 (7) {
["data"]=>
object(stdClass)#388 (10) {
["ID"]=>
string(2) "53"
["user_login"]=>
string(14) "SubscriberTest"
["user_pass"]=>
string(34) "$P$B8O8w6awJnKrHNoFLOyHJHfKiPE1nt/"
["user_nicename"]=>
string(14) "subscribertest"
["user_email"]=>
string(33) "[email protected]"
["user_url"]=>
string(0) ""
["user_registered"]=>
string(19) "2013-05-23 05:56:42"
["user_activation_key"]=>
string(0) ""
["user_status"]=>
string(1) "0"
["display_name"]=>
string(14) "SubscriberTest"
}
["ID"]=>
int(53)
["caps"]=>
array(1) {
["subscriber"]=>
bool(true)
}
["cap_key"]=>
string(15) "wp_capabilities"
["roles"]=>
array(1) {
[0]=>
string(10) "subscriber"
}
["allcaps"]=>
array(3) {
["read"]=>
bool(true)
["level_0"]=>
bool(true)
["subscriber"]=>
bool(true)
}
["filter"]=>
NULL
}
워드 프레스 제어판 로그인이 여전히 작동하고 :
$user = wp_signon('', $secure_cookie);
var_dump($user);
패킷을 도청 피들러를 사용하여,이 프로덕션 서버에서 반환하는 것입니다 :
다음 코드는이 보여 쿠키는 백엔드에 서명 할 때 삽입됩니다.
프로덕션 서버에서도 CloudFlare를 사용하고 있지만 연관성이 있는지 여부는 확실하지 않습니다. 클라우드 플레어 (Cloud Flare)에게도 지원 티켓을 보냈는데, 프록시 서비스가이를 제거 할 수 있는지 여부를 확인할 수 있기를 바랍니다.
동일한 코드를 실행할 때 응답 헤더 부분이 내 개발 서버에서 보이는 부분입니다. 이 일에서 당신은 쿠키가 전송되고 있음을 볼 수 있습니다
HTTP/1.1 302 Found
Date: Fri, 24 May 2013 02:18:23 GMT
Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: W3 Total Cache/0.9.2.11
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
X-Pingback: http://domain.com/blog/xmlrpc.php
X-Frame-Options: SAMEORIGIN
Set-Cookie: wordpress_548d950a57c83d7fc5c2eb781062ef26=SubscriberTest%7C1369534704%7C08d4578ca9049beadffa39e0be0ea941; path=/blog/wp-content/plugins; httponly
Set-Cookie: wordpress_548d950a57c83d7fc5c2eb781062ef26=SubscriberTest%7C1369534704%7C08d4578ca9049beadffa39e0be0ea941; path=/blog/wp-admin; httponly
Set-Cookie: wordpress_logged_in_548d950a57c83d7fc5c2eb781062ef26=SubscriberTest%7C1369534704%7Cc41eb224ebec7f57982d0f93e70f7cff; path=/; httponly
Set-Cookie: wordpress_logged_in_548d950a57c83d7fc5c2eb781062ef26=SubscriberTest%7C1369534704%7Cc41eb224ebec7f57982d0f93e70f7cff; path=/blog/; httponly
Location: http://domain.com/
Vary: Accept-Encoding
Content-Length: 0
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8
아침 승무원을 존중하는 것은 몇 가지 아이디어가있을 수 있습니다. 나는 1 주일 이상 동안이 놈과 싸우고 있었고, 주말을 떠나기 전에 오늘 그것을 고정시켜야한다. : ( – Mark1270287