php – Zend / Apache2:在多次请求url时找到302
发布时间:2020-12-13 13:26:52 所属栏目:PHP教程 来源:网络整理
导读:我正在使用Zend框架编写REST API. 当多次调用url(例如1000次,每秒1次请求)时,在大约0.2%的情况下,而不是获得200 OK作为响应,我得到302 Found – 所以重定向到不同的页面. 这是整个服务器响应: 302 Found Date: Mon,04 Mar 2013 11:56:04 GMTServer: Apache
我正在使用Zend框架编写REST API.
当多次调用url(例如1000次,每秒1次请求)时,在大约0.2%的情况下,而不是获得200 OK作为响应,我得到302 Found – 所以重定向到不同的页面. 这是整个服务器响应: 302 Found Date: Mon,04 Mar 2013 11:56:04 GMT Server: Apache/2.2.17 (Ubuntu) X-Powered-By: PHP/5.3.5-1ubuntu7.11 Set-Cookie: PHPSESSID=ui9r8jqa63dbom8osknso6eea5; path=/ 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 Location: /de/default/index/index/error/500 Vary: Accept-Encoding Content-Length: 0 Content-Type: text/html; charset=utf-8 所以Zend重定向到错误500(内部服务器错误)页面.问题是为什么 – 我只是想不出来…… Apache2有大约20个并发连接打开,服务器负载<<< 1所以我真的不明白为什么请求会导致问题. 我知道远程诊断这是一个非常困难的问题,但是如何解决这个问题的好猜测和建议非常受欢迎!谢谢. 这是@chris要求的apache vhost配置: <IfModule mod_ssl.c> <VirtualHost mydomain.tld:443> ServerAdmin webmaster@localhost DocumentRoot /var/www ServerName www.mydomain.tld ServerAlias mydomain.tld *.mydomain.tld <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog /var/log/apache2/error.log # Possible values include: debug,info,notice,warn,error,crit,# alert,emerg. LogLevel warn CustomLog /var/log/apache2/ssl_access.log combined # RewriteLog "/var/log/htaccess.log" # RewriteLogLevel 5 Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> # SSL Engine Switch: # Enable/Disable SSL for this virtual host. SSLEngine on SSLOptions +StrictRequire SSLCertificateFile /etc/apache2/ssl/cert_2013_2014.crt SSLCertificateKeyFile /etc/apache2/ssl/www.mydomain.tld.key SSLCACertificateFile /etc/apache2/ssl/intermediate.crt </VirtualHost> </IfModule>
这对我来说非常简单直接.这是一个302重定向,我不能想到ZF中任何重定向的东西;特别是不要500错误页面. 500错误(内部服务器错误)必须始终返回500错误,并且永远不应该是302重定向.所以你在这里很幸运,因为你的RETS API中必须有一些错误处理导致重定向到某个地方(而不是常规的错误页面).
在代码中搜索重定向.可以使用ZF重定向器帮助程序(在控制器内)或使用header()和exit()手动(任何地)完成.当您发现重定向时,使用debug_backtrace显示(退出)或将其转储到日志文件中.并修复返回代码或处理错误的方式. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |