After some other issues have been raised such as not found errorPage for a
web-app without QuercusServlet, I've found a work around.
Moving the conditional rewrite include from <host> to <web-app-default>
seems to fix these issues with changing Real-Path.

-- Steffen


2010/6/25 Steffen Busch <steffen.bu...@gmail.com>

> Hi,
>
> I'm using Resin 3.1.10 and experience a very, very strange behavior with
> Resin's PHP Admin console.
> In a Nutshell:
> Using a conditional rewrite for the resin-admin web-app changes the
> getRealPath() when accessing /index.php from the original location to the
> ROOT-Webapp
>
> I was able to reproduce it on a clean installation.
> That's how I did it:
>
>
> 1.) Created a dummy index.php file in ${resin.root}/webapps/ROOT.
> This file just contains:
>
> Welcome to dummy index.php of the ROOT Web-App. Your IP Address is <?php
> echo $_SERVER["REMOTE_ADDR"]; ?>
>
> 2.) Modifying resin.conf:
> - Added <resin:import> with messages and a rewrite condition.
> - Removed <prologue> as I want to have no authentication in this bug
> reproduction case
>
>     <!-- configures the default host, matching any host name -->
>     <host id="" root-directory=".">
>
>       <resin:import path="${resin.root}/conf/fallback.conf"
> optional="true"/>
>
>       <!--
>          - configures an explicit root web-app matching the
>          - webapp's ROOT
>         -->
>       <web-app id="/" root-directory="webapps/ROOT"/>
>
>       <web-app id="/resin-admin" root-directory="${resin.home}/php/admin">
>       </web-app>
>
>
> 3.) Created file fallback.conf in folder ${resin.root}/conf
> This file contains:
>
> <host xmlns="http://caucho.com/ns/resin";
>                   xmlns:resin="http://caucho.com/ns/resin/core";>
>
>   <resin:message>External configuration read from '${__FILE__}'
> ...</resin:message>
>
>     <resin:message>This Resin Instance is acting as
> Fallback</resin:message>
>     <resin:message>External IP Addresses will be redirected to
> www.google.com</resin:message>
>     <resin:message>Certain IP Addresses are allowed to
> access</resin:message>
>
>       <rewrite-dispatch>
>           <moved-permanently regexp="^/" target="http://www.google.com/";>
>             <not>
>               <or>
>                 <when remote-addr="127.0.0.1"/> <!-- Matching IP, should
> not forward you to Google -->
>                 <!-- Usually further IPs, therefore the 'or' -->
>               </or>
>             </not>
>           </moved-permanently>
>       </rewrite-dispatch>
>
> </host>
>
>
> 4.) Modified ${resin.home}/php/admin/WEB-INF/resin-web.xml
> - Only the PHP Servlet is active
> - Other authentication stuff has been removed
>
> <web-app xmlns="http://caucho.com/ns/resin";
>          xmlns:resin="http://caucho.com/ns/resin/core";>
>
>   <servlet-mapping url-pattern="*.php"
>
> servlet-class="com.caucho.quercus.servlet.QuercusServlet"/>
> </web-app>
>
>
>
> Expectation:
> Accessing http://localhost:8080/resin-admin should serve
> ${resin.home}/php/admin/index.php
>
> Actual Result:
> The "index.php" from the ROOT Web-App is shown.
>
> Welcome to dummy index.php of the ROOT Web-App. Your IP Address is
> 127.0.0.1
>
>
>
> Then I've added finest debug logging in resin.conf like this:
>
>    <log path='${resin.root}/logs/debug_full.log'
>         level='finest'
>         timestamp='[%Y-%m-%d %H:%M:%S.%s] {%{thread}} '
>         format=" '${app.contextPath}' ${log.level} ${log.sourceClassName}
> (${log.sourceMethodName}) ${log.message}">
>      <logger name="com.caucho" level="finest"/>
>    </log>
>
>
> There are several interesting things in the debug log, here is only an
> excerpt.
> Please see how the getRealPath() changes:
>
> [2010-06-25 17:49:43.138] {http--8080-1$17388264}  '' FINE
> com.caucho.server.http.HttpRequest (handleRequest) Http[1] GET /resin-admin/
> HTTP/1.1
> [2010-06-25 17:49:43.138] {http--8080-1$17388264}  '' FINE
> com.caucho.server.http.HttpRequest (handleRequest) Http[1] Remote-IP:
> 127.0.0.1:2510
> [2010-06-25 17:49:43.138] {http--8080-1$17388264}  '' FINE
> com.caucho.server.http.HttpRequest (parseHeaders) Http[1] Host:
> localhost:8080
> [2010-06-25 17:49:43.138] {http--8080-1$17388264}  '' FINE
> com.caucho.server.http.HttpRequest (parseHeaders) Http[1] User-Agent:
> Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.4) Gecko/20100611
> Firefox/3.6.4 GTB7.0
> ...
> [2010-06-25 17:49:43.138] {http--8080-1$17388264}  '' FINE
> com.caucho.server.http.HttpRequest (parseHeaders) Http[1] Keep-Alive: 115
> [2010-06-25 17:49:43.154] {http--8080-1$17388264}  '' FINE
> com.caucho.server.http.HttpRequest (parseHeaders) Http[1] Connection:
> keep-alive
> [2010-06-25 17:49:43.154] {http--8080-1$17388264}  '' FINE
> com.caucho.server.http.HttpRequest (parseHeaders) Http[1] Cache-Control:
> max-age=0
> [2010-06-25 17:49:43.154] {http--8080-1$17388264}  '/resin-admin' FINEST
> com.caucho.server.webapp.WebApp (getRealPath) real-path / ->
> D:\IDE\Appsrv\BUG\resin-pro-3.1.10\php\admin\
> ...
> [2010-06-25 17:49:43.154] {http--8080-1$17388264}
> [2010-06-25 17:49:43.154] {http--8080-1$17388264}  '/resin-admin' FINEST
> com.caucho.server.webapp.WebApp (getRealPath) real-path /index.jsp ->
> D:\IDE\Appsrv\BUG\resin-pro-3.1.10\php\admin\index.jsp
> [2010-06-25 17:49:43.154] {http--8080-1$17388264}  '/resin-admin' FINEST
> com.caucho.server.webapp.WebApp (getRealPath) real-path /index.php ->
> D:\IDE\Appsrv\BUG\resin-pro-3.1.10\php\admin\index.php
> [2010-06-25 17:49:43.154] {http--8080-1$17388264}  '/resin-admin' FINE
> com.caucho.server.dispatch.ServletMapper (mapServlet) invoke (uri:/index.php
> -> *.php)
> [2010-06-25 17:49:43.154] {http--8080-1$17388264}  '' FINEST
> com.caucho.server.rewrite.RewriteDispatch (map) rewrite-dispatch check uri
> '/resin-admin/'
> [2010-06-25 17:49:43.154] {http--8080-1$17388264}  '' FINER
> com.caucho.server.rewrite.AbstractRuleWithConditions (map) match .*
> '/resin-admin/' --> '/resin-admin/'
> [2010-06-25 17:49:43.154] {http--8080-1$17388264}  '' FINER
> com.caucho.server.dispatch.ServletInvocation (service) Dispatch '/index.php'
> to com.caucho.server.rewrite.conditionfilterch...@e3fda4
> [2010-06-25 17:49:43.154] {http--8080-1$17388264}  '' FINER
> com.caucho.server.rewrite.ConditionFilterChain (doFilter) null ^/
> '/resin-admin/' --> 'http://www.google.com/resin-admin/'
> ...
> [2010-06-25 17:49:43.669] {http--8080-1$17388264}  '/resin-admin' FINEST
> com.caucho.server.webapp.WebApp (getRealPath) real-path /index.php ->
> D:\IDE\Appsrv\BUG\resin-pro-3.1.10\webapps\ROOT\index.php
> [2010-06-25 17:49:43.810] {http--8080-1$17388264}  '/resin-admin' FINEST
> com.caucho.loader.DynamicClassLoader (addLoader) DynamicClassLoader[] adding
> loader
> SimpleLoader[/D:/IDE/Appsrv/BUG/resin-pro-3.1.10/php/admin/WEB-INF/work]
> [2010-06-25 17:49:43.810] {http--8080-1$17388264}  '/resin-admin' FINEST
> com.caucho.loader.DynamicClassLoader (addLoader) DynamicClassLoader[] adding
> loader
> SimpleLoader[/D:/IDE/Appsrv/BUG/resin-pro-3.1.10/php/admin/WEB-INF/work,prefix=_quercus._d_23a._ide._appsrv._bug._resin_22dpro_22d3__1__10._webapps._root]
> [2010-06-25 17:49:43.826] {http--8080-1$17388264}  '/resin-admin' CONFIG
> com.caucho.loader.ClassEntry (<clinit>) In-place class redefinition
> (HotSwap) is available.
> [2010-06-25 17:49:43.826] {http--8080-1$17388264}  '/resin-admin' FINE
> com.caucho.quercus.page.ProPageManager (compilePage)
> Quercus[/D:/IDE/Appsrv/BUG/resin-pro-3.1.10/webapps/ROOT/index.php] loading
> precompiled page
> [2010-06-25 17:49:43.873] {http--8080-1$17388264}  '/resin-admin' FINEST
> com.caucho.server.webapp.WebApp (getRealPath) real-path / ->
> D:\IDE\Appsrv\BUG\resin-pro-3.1.10\webapps\ROOT\
>
>
>
> And now the same request with disabled included fallback.conf containing
> the conditional rewrite:
>
>
> [2010-06-25 17:52:41.252] {http--8080-2$25277396}  '' FINE
> com.caucho.server.http.HttpRequest (handleRequest) Http[2] GET /resin-admin/
> HTTP/1.1
> [2010-06-25 17:52:41.252] {http--8080-2$25277396}  '' FINE
> com.caucho.server.http.HttpRequest (handleRequest) Http[2] Remote-IP:
> 127.0.0.1:2556
> [2010-06-25 17:52:41.252] {http--8080-2$25277396}  '' FINE
> com.caucho.server.http.HttpRequest (parseHeaders) Http[2] Host:
> localhost:8080
> [2010-06-25 17:52:41.252] {http--8080-2$25277396}  '' FINE
> com.caucho.server.http.HttpRequest (parseHeaders) Http[2] User-Agent:
> Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.4) Gecko/20100611
> Firefox/3.6.4 GTB7.0
> ...
> [2010-06-25 17:52:41.252] {http--8080-2$25277396}  '' FINE
> com.caucho.server.http.HttpRequest (parseHeaders) Http[2] Pragma: no-cache
> [2010-06-25 17:52:41.252] {http--8080-2$25277396}  '' FINE
> com.caucho.server.http.HttpRequest (parseHeaders) Http[2] Cache-Control:
> no-cache
> [2010-06-25 17:52:41.268] {http--8080-2$25277396}  '/resin-admin' FINEST
> com.caucho.server.webapp.WebApp (getRealPath) real-path / ->
> D:\IDE\Appsrv\BUG\resin-pro-3.1.10\php\admin\
> ...
> [2010-06-25 17:52:41.268] {http--8080-2$25277396}  '/resin-admin' FINEST
> com.caucho.server.webapp.WebApp (getRealPath) real-path /index.jsp ->
> D:\IDE\Appsrv\BUG\resin-pro-3.1.10\php\admin\index.jsp
> [2010-06-25 17:52:41.268] {http--8080-2$25277396}  '/resin-admin' FINEST
> com.caucho.server.webapp.WebApp (getRealPath) real-path /index.php ->
> D:\IDE\Appsrv\BUG\resin-pro-3.1.10\php\admin\index.php
> [2010-06-25 17:52:41.268] {http--8080-2$25277396}  '/resin-admin' FINE
> com.caucho.server.dispatch.ServletMapper (mapServlet) invoke (uri:/index.php
> -> *.php)
> [2010-06-25 17:52:41.268] {http--8080-2$25277396}  '' FINER
> com.caucho.server.dispatch.ServletInvocation (service) Dispatch '/index.php'
> to WebAppFilterChain[http://localhost:8080/resin-admin,
> next=ServletFilterChain[*.php]]
> ...
> [2010-06-25 17:52:41.658] {http--8080-2$25277396}  '/resin-admin' FINER
> com.caucho.server.dispatch.ServletConfigImpl (createServlet) Servlet[*.php]
> active
> [2010-06-25 17:52:41.658] {http--8080-2$25277396}  '/resin-admin' FINEST
> com.caucho.server.dispatch.ServletConfigImpl (createServlet)
> javax.management.NotCompliantMBeanException:
> resin:type=QuercusServlet,Host=default,WebApp=/resin-admin,name="\*.php"
> mbean has no MBean interface
> [2010-06-25 17:52:41.658] {http--8080-2$25277396}  '/resin-admin' FINER
> com.caucho.server.dispatch.ServletConfigImpl (createServlet) Servlet[*.php]
> active
> [2010-06-25 17:52:41.674] {http--8080-2$25277396}  '/resin-admin' FINEST
> com.caucho.loader.DynamicClassLoader (addLoader) DynamicClassLoader[] adding
> loader
> SimpleLoader[/D:/IDE/Appsrv/BUG/resin-pro-3.1.10/php/admin/WEB-INF/work]
> [2010-06-25 17:52:41.799] {http--8080-2$25277396}  '/resin-admin' FINEST
> com.caucho.loader.DynamicClassLoader (addLoader) DynamicClassLoader[] adding
> loader
> SimpleLoader[/D:/IDE/Appsrv/BUG/resin-pro-3.1.10/php/admin/WEB-INF/work,prefix=_quercus]
> [2010-06-25 17:52:41.799] {resin-16}  '/resin-admin' FINEST
> com.caucho.loader.DynamicClassLoader (addLoader) DynamicClassLoader[] adding
> loader
> SimpleLoader[/D:/IDE/Appsrv/BUG/resin-pro-3.1.10/php/admin/WEB-INF/work,prefix=_quercus]
> [2010-06-25 17:52:41.830] {resin-16}  '/resin-admin' CONFIG
> com.caucho.java.JavaCompiler (compileInt) Compiling
> _quercus/_index__php.java
> [2010-06-25 17:52:41.830] {Thread-4}  '/resin-admin' FINEST
> com.caucho.loader.DynamicClassLoader (addLoader) DynamicClassLoader[] adding
> loader JarLoader[]
> ...
> [2010-06-25 17:52:41.862] {http--8080-2$25277396}  '/resin-admin' FINEST
> com.caucho.loader.DynamicClassLoader (addLoader) DynamicClassLoader[] adding
> loader
> SimpleLoader[/D:/IDE/Appsrv/BUG/resin-pro-3.1.10/php/admin/WEB-INF/work,prefix=_quercus._web_22dinf._php]
> [2010-06-25 17:52:41.862] {http--8080-2$25277396}  '/resin-admin' FINER
> com.caucho.webbeans.manager.WebBeansContainer (bind)
> WebBeansContainer[system] bind(ServletAuthenticator) returns
> SingletonComponent[ManagementAuthenticator, @Standard, name=resin-admin,
> @SingletonScope]
> [2010-06-25 17:52:41.862] {http--8080-2$25277396}  '/resin-admin' FINE
> com.caucho.server.security.AbstractLogin (getAuthenticator) BasicLogin[]
> using ManagementAuthenticator[MD5-base64,resin]
> [2010-06-25 17:52:41.862] {http--8080-2$25277396}  '/resin-admin' FINE
> com.caucho.server.connection.AbstractHttpRequest (isUserInRole) no user for
> isUserInRole
> ...
> [2010-06-25 17:52:41.862] {http--8080-2$25277396}  '/resin-admin' FINE
> com.caucho.server.http.HttpResponse (writeHeadersInt) Http[2] HTTP/1.1 302
> Found
> [2010-06-25 17:52:41.862] {http--8080-2$25277396}  '/resin-admin' FINE
> com.caucho.server.http.HttpResponse (writeHeadersInt) Http[2] Expires: 01
> Dec 1994 16:00:00 GMT
> [2010-06-25 17:52:41.862] {http--8080-2$25277396}  '/resin-admin' FINE
> com.caucho.server.http.HttpResponse (writeHeadersInt) Http[2] Cache-Control:
> max-age=0,private
> [2010-06-25 17:52:41.862] {http--8080-2$25277396}  '/resin-admin' FINE
> com.caucho.server.http.HttpResponse (writeHeadersInt) Http[2] Pragma:
> No-Cache
> [2010-06-25 17:52:41.862] {http--8080-2$25277396}  '/resin-admin' FINE
> com.caucho.server.http.HttpResponse (writeHeadersInt) Http[2] Location:
> http://localhost:8080/resin-admin/status.php
> [2010-06-25 17:52:41.862] {http--8080-2$25277396}  '/resin-admin' FINE
> com.caucho.server.http.HttpResponse (writeHeadersInt) Http[2] Content-Type:
> text/html
> [2010-06-25 17:52:41.862] {http--8080-2$25277396}  '/resin-admin' FINE
> com.caucho.server.http.HttpResponse (writeHeadersInt) Http[2]
> Content-Length: 0
> [2010-06-25 17:52:41.893] {http--8080-2$25277396}  '' FINE
> com.caucho.server.http.HttpRequest (handleRequest) Http[2] keepalive
> [2010-06-25 17:52:41.893] {http--8080-2$25277396}  '' FINE
> com.caucho.server.port.TcpConnection (keepalive) Tcp[,2] keepalive (thread)
> [2010-06-25 17:52:41.908] {http--8080-2$22322411}  '' FINE
> com.caucho.server.http.HttpRequest (handleRequest) Http[2] GET
> /resin-admin/status.php HTTP/1.1
> [2010-06-25 17:52:41.908] {http--8080-2$22322411}  '' FINE
> com.caucho.server.http.HttpRequest (handleRequest) Http[2] Remote-IP:
> 127.0.0.1:2556
> [2010-06-25 17:52:41.908] {http--8080-2$22322411}  '' FINE
> com.caucho.server.http.HttpRequest (parseHeaders) Http[2] Host:
> localhost:8080
> ,,,
> [2010-06-25 17:52:41.908] {http--8080-2$22322411}  '/resin-admin' FINE
> com.caucho.server.dispatch.ServletMapper (mapServlet) invoke
> (uri:/status.php -> *.php)
> [2010-06-25 17:52:41.908] {http--8080-2$22322411}  '' FINER
> com.caucho.server.dispatch.ServletInvocation (service) Dispatch
> '/status.php' to WebAppFilterChain[http://localhost:8080/resin-admin,
> next=ServletFilterChain[*.php]]
> [2010-06-25 17:52:41.908] {http--8080-2$22322411}  '/resin-admin' FINEST
> com.caucho.server.webapp.WebApp (getRealPath) real-path /status.php ->
> D:\IDE\Appsrv\BUG\resin-pro-3.1.10\php\admin\status.php
> [2010-06-25 17:52:41.924] {http--8080-2$22322411}  '/resin-admin' FINEST
> com.caucho.loader.DynamicClassLoader (addLoader) DynamicClassLoader[] adding
> loader
> SimpleLoader[/D:/IDE/Appsrv/BUG/resin-pro-3.1.10/php/admin/WEB-INF/work]
> ...
>
> You see, it's working without that conditional rewrite.
> It will also work when all the "*.php" Servlet Mappings for the
> QuercusServlet are removed (app-default.xml and
> php/admin/WEB-INF/resin-web.xml). Accessing /resin-admin will contain an
> empty page with the php source.
>
> So, there seems to be a connection between the conditional rewrite and the
> QuercusServlet. Also other web-apps within that host behave normal.
>
> When I change the condition in the rewrite clause to match, I will be
> forwarded to google.com.
>
> Any Idea how to work around that issue?
>
> Thanks and best regards,
> Steffen
>
_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to