[opencms-dev] handle404 appears on every 404 page within the export folder

Mario Jäger m.jaeger at alkacon.com
Mon Aug 30 09:46:52 CEST 2010


Hi Graeme,

Try it with that line:
RewriteRule       .*     balancer://mycluster/opencms/handle404?exporturi=%{REQUEST_URI}&%{QUERY_STRING} [P]

instead of that line, please:
RewriteRule       .*     balancer://mycluster/handle404?exporturi=%{REQUEST_URI}&%{QUERY_STRING} [P]


Because, I thought, that www.test.com is your own test site, I thought, that you do not get the OpenCms 404 error page, but another 404 error page. But, I think that you get the OpenCms 404 error page that says, that the 
requested resource "/handle404" is not available. If you change the line above, than that problem does not more exist. 

-- 
Kind Regards,
Mario.
 
-------------------
Mario Jäger
 
Alkacon Software GmbH  - The OpenCms Experts                    
http://www.alkacon.com - http://www.opencms.org


Graeme Kidd schrieb:
>
> Sorry I dont have a publically available url but the export processes does work. For example I could have this URL:
> http://www.test.com/export/doesexist.gif
>
> If I delete "export/doesexist.gif" from the RFS then its created again as soon as I visit "http://www.test.com/export/doesexist.gif".
>
> When I attempt to go to a URL that contains the export path and the file really doesnt exist on either the VFS or RFS. It causes me to get a 404 page that mentions /handle404 e.g http://www.test.com/export/doesnotexist.gif
>
> I installed OpenCms as the Root and followed this because I am using mod_proxy with mod_proxy_ajp and mod_proxy_balancer:
> http://www.opencms-wiki.org/Avoiding_/opencms/opencms_in_the_URL_%28apache_%2B_mod_proxy%29
>
> This means my virtual host looks like this:
> < VirtualHost *:80>
>     < Directory "D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/ROOT/">
>         Order allow,deny
>         Allow from all
>     < / Directory> 
>     ServerName test.co.uk
>     DocumentRoot "D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/ROOT/"
>     ErrorLog logs/error.log
>     
>     # Log only non-redirect requests in "normal" log file
>     SetEnvIf Request_URI "\/opencms\/*" redirect
>     CustomLog logs/test.co.uk-access.log common env=!redirect
>         
>     RewriteEngine     on
>     RewriteLog logs/test.rewrite.log
>     RewriteLogLevel 9
>     
>     # Redirect all request to non-existing file in the export directory to OpenCms which will generate the files "on the fly"
>     RewriteCond       %{REQUEST_URI}                                            ^/export/(.*) [NC]
>     RewriteCond       "%{DOCUMENT_ROOT}%{REQUEST_FILENAME}"                     !-f
>     RewriteCond       "%{DOCUMENT_ROOT}%{REQUEST_FILENAME}/index_export.html"   !-f
>     RewriteRule       .*     balancer://mycluster/handle404?exporturi=%{REQUEST_URI}&%{QUERY_STRING} [P]     
>     
>     # Also redirect all other 404 errors to OpenCms
>     ErrorDocument     404                                /system/shared/handle404.html
>
>     ProxyPass         /opencms/                 !
>     RedirectPermanent /opencms/                 http://test.co.uk/
>     
>     ProxyPass         /resources/               !
>     ProxyPass         /export/                  !
>     
>     ProxyPass         /                         balancer://mycluster/opencms/
>     ProxyPassReverse  /                         balancer://mycluster/opencms/
> < / VirtualHost>
>
> Graeme
>
>
> ----------------------------------------
>   
>> Date: Fri, 27 Aug 2010 10:07:48 +0200
>> From: m.jaeger at alkacon.com
>> To: opencms-dev at opencms.org
>> Subject: Re: [opencms-dev] handle404 appears on every 404 page within the export folder
>>
>> Hi Graeme,
>>
>> Send us an example link to a successful exported OpenCms resource, please.
>>
>> What is the name of your OpenCms application in TomCat?
>>
>> Did you configure your OpenCms, TomCat and Apache like described here?: http://www.opencms-wiki.org/MultiSite_configuration_instructions_%28apache_%2B_mod_jk%29
>>
>> --
>> Kind Regards,
>> Mario.
>>
>> -------------------
>> Mario Jäger
>>
>> Alkacon Software GmbH - The OpenCms Experts
>> http://www.alkacon.com - http://www.opencms.org
>>
>>
>> Graeme Kidd schrieb:
>>     
>>> Yes sorry I copy and pasted from the documentation and not my real config so it does actually says:
>>> RewriteRule .* balancer://mycluster/handle404?exporturi=%{REQUEST_URI}&%{QUERY_STRING} [P]
>>>
>>> Any other ideas?
>>>
>>> Thanks,
>>> Graeme
>>>
>>>
>>> ----------------------------------------
>>>
>>>       
>>>> Date: Thu, 26 Aug 2010 09:36:58 +0200
>>>> From: m.jaeger at alkacon.com
>>>> To: opencms-dev at opencms.org
>>>> Subject: Re: [opencms-dev] handle404 appears on every 404 page within the export folder
>>>>
>>>> Hi Graeme,
>>>>
>>>> It seems, that you use Apache with mod_jk.
>>>>
>>>> Please, have a look here to check your configuration: http://www.opencms-wiki.org/MultiSite_configuration_instructions_%28apache_%2B_mod_jk%29
>>>>
>>>> I think one point is, that you should use the following line in the Apache configuration, if your OpenCms installation is installed as the ROOT application in Tomcat:
>>>>
>>>> RewriteRule .* http://127.0.0.1:8081/opencms/handle404?exporturi=%{REQUEST_URI}&%{QUERY_STRING} [P]
>>>>
>>>> instead of that line:
>>>>
>>>> RewriteRule .* http://127.0.0.1:8081/handle404?exporturi=%{REQUEST_URI}&%{QUERY_STRING} [P]
>>>>
>>>> --
>>>> Kind Regards,
>>>> Mario.
>>>>
>>>> -------------------
>>>> Mario Jäger
>>>>
>>>> Alkacon Software GmbH - The OpenCms Experts
>>>> http://www.alkacon.com - http://www.opencms.org
>>>>
>>>>
>>>> Graeme Kidd schrieb:
>>>>
>>>>         
>>>>> Hi,
>>>>>
>>>>> I am using the "CmsOnDemandStaticExportHandler" Static Export Handler which requires the following mod_rewrite configuration:
>>>>> RewriteCond %{REQUEST_URI} ^/export/(.*) [NC]
>>>>> RewriteCond "%{DOCUMENT_ROOT}%{REQUEST_FILENAME}" !-f
>>>>> RewriteCond "%{DOCUMENT_ROOT}%{REQUEST_FILENAME}/index_export.html" !-f
>>>>> RewriteRule .* http://127.0.0.1:8081/handle404?exporturi=%{REQUEST_URI}&%{QUERY_STRING} [P]
>>>>>
>>>>> This all works fine when the resource doesn’t exist but is still to be exported, what I find annoying however is when the file really doesn't exist. As it causes the 404 page to say this within the export directory:
>>>>> "The requested resource "/handle404" was not found on the server."
>>>>>
>>>>> So for example you could have:
>>>>> http://www.test.com/export/doesnotexist.gif
>>>>>
>>>>> Then instead of saying:
>>>>> The requested resource "/export/doesnotexist.gif" was not found on the server.
>>>>>
>>>>> It says:
>>>>> The requested resource "/handle404" was not found on the server.
>>>>>
>>>>> I have tried changing the line to "request.getRequestURL()" and "request.getServletPath()" but they both return a path that includes handle404.
>>>>>
>>>>> The only way round this I can think of would be to use JavaScript in the handle404.jsp page e.g.
>>>>> "document.location.href"
>>>>>
>>>>> If that is the best solution then might I suggest that a future improvement would be to detect if the file really doesn’t exist and return the URI to its original location.
>>>>>
>>>>> Thanks,
>>>>> Graeme
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> This mail is sent to you from the opencms-dev mailing list
>>>>> To change your list options, or to unsubscribe from the list, please visit
>>>>> http://lists.opencms.org/mailman/listinfo/opencms-dev
>>>>>
>>>>>
>>>>>           
>>>> _______________________________________________
>>>> This mail is sent to you from the opencms-dev mailing list
>>>> To change your list options, or to unsubscribe from the list, please visit
>>>> http://lists.opencms.org/mailman/listinfo/opencms-dev
>>>>
>>>>         
>>> _______________________________________________
>>> This mail is sent to you from the opencms-dev mailing list
>>> To change your list options, or to unsubscribe from the list, please visit
>>> http://lists.opencms.org/mailman/listinfo/opencms-dev
>>>
>>>       
>> _______________________________________________
>> This mail is sent to you from the opencms-dev mailing list
>> To change your list options, or to unsubscribe from the list, please visit
>> http://lists.opencms.org/mailman/listinfo/opencms-dev
>>     
>  		 	   		  
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>   



More information about the opencms-dev mailing list