Typo3多域与ssl:TOO_MANY_REDIRECTS

时间:2012-11-07 11:01:41

标签: ssl cross-domain typo3 extbase realurl

使用typo3 4.5 / extbase 1.3我试图在多域环境中运行我的商店扩展:商店页面应该在HTTP域A上运行,并在HTTPS域B上执行以下结帐过程。域B是https:/ /www.ssl-id.de/[domainA](主持人是Strato)。因此我设定了:

  1. 两个页面树,两个根分别具有域A和域B的域条目
  2. HTTPS页面树中的结帐页面已将“使用协议”设置为HTTPS
  3. TS:baseURL有条件地设置为域A或域B(基于ENV:HTTP_HOST)
  4. 为两个域设置了realurl配置(使用$ TYPO3_CONF_VARS ['EXTCONF'] ['realurl'] ['[domainA]']和$ TYPO3_CONF_VARS ['EXTCONF'] ['realurl'] ['www.ssl -id.de'])
  5. 不幸的是,从HTTP商店到HTTPS结帐的重定向导致chrome中出现错误310(net :: ERR_TOO_MANY_REDIRECTS)。网络报告说

    Request URL:https://www.ssl-id.de/[domainA]/de/checkout.html?FE_SESSION_KEY=bc04cd0f5b835bcbdd8c475bafb037f7-ab3700f6a9fae520b75981130b31ec77&cHash=6d7e7195735947b09becbfa9c26c8bf0
    Request Method:GET
    Status Code:301 Moved Permanently
    Request Headersview source
    Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
    Accept-Encoding:gzip,deflate,sdch
    Accept-Language:de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
    Cache-Control:max-age=0
    Connection:keep-alive
    Cookie:fe_typo_user=bc04cd0f5b835bcbdd8c475bafb037f7
    Host:www.ssl-id.de
    User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4
    Query String Parametersview URL encoded
    FE_SESSION_KEY:bc04cd0f5b835bcbdd8c475bafb037f7-ab3700f6a9fae520b75981130b31ec77
    cHash:6d7e7195735947b09becbfa9c26c8bf0
    Response Headersview source
    Connection:Keep-Alive
    Content-Length:0
    Content-Type:text/html; charset=utf-8
    Date:Wed, 07 Nov 2012 09:54:06 GMT
    Keep-Alive:timeout=3, max=99
    Location:https://www.ssl-id.de/[domainA]/de/checkout.html?FE_SESSION_KEY=bc04cd0f5b835bcbdd8c475bafb037f7-ab3700f6a9fae520b75981130b31ec77&cHash=6d7e7195735947b09becbfa9c26c8bf0
    Server:Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8r
    Set-Cookie:fe_typo_user=bc04cd0f5b835bcbdd8c475bafb037f7; path=/[domainA]/
    X-Powered-By:PHP/5.3.8
    

    读作“目标页面网址不存在,请再次查看相同的网址”。使用第二个HTTP网址而不是HTTPS网址时,设置效果很好。直接调用结帐页面而不从商店页面重定向时,结果是相同的错误310。

    .htaccess是一个相当标准的错字3-realurl .htaccess:

    AddDefaultCharset utf-8
    
    AddType video/mp4 mp4
    AddType video/mp4 m4v
    AddType video/ogg ogv
    AddType video/webm webm
    AddType video/webm webmv
    
    <FilesMatch "\.(js|css)$">
      <IfModule mod_expires.c>
        ExpiresActive on
        ExpiresDefault "access plus 7 days"
      </IfModule>
      FileETag MTime Size
    </FilesMatch>
    
    <IfModule mod_rewrite.c>
    
    RewriteEngine On
    #RewriteBase /
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]
    
    RewriteRule ^(typo3/|t3lib/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
    
    RewriteRule ^typo3$ typo3/index_re.php [L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule .* index.php [L]
    
    </IfModule>
    

    有关如何删除重定向问题或如何更接近导致无限循环的重定向调用者的任何建议?

1 个答案:

答案 0 :(得分:3)

问题一直是主机(Strato):他们的SSL代理不会发送相关的$ _SERVER ['HTTPS'],这会让typo3变得疯狂。

解决方案是通过在localconf.php的末尾添加以下行来自行设置$ _SERVER ['HTTPS']:

if ($_SERVER['HTTP_X_FORWARDED_HOST'] == "www.ssl-id.de") {  
    $_SERVER['HTTPS'] = 1;  
}

或更一般

if (this_is_a_ssl_request()) {  
    $_SERVER['HTTPS'] = 1;  
}