Let me say from the start I am not an Apache person so it is entirely possible there is an issue with our config and not with plone.subrequest, but let me lay out exactly what is happening.
Site url: https://portals.mysite.com/demo-portal
Internal server url: http://myserver.com:9500/db01/plone_demo
Apache rewrite rule:
RewriteRule ^/demo-portal(.*|$) http://myserver.com:9500/VirtualHostBase/https/%{HTTP_HOST}:443/db01/plone_demo/VirtualHostRoot/_vh_demo-portal$1 [proxy,last]
This works in almost every case but I noticed a problem with plone.subrequest. When cooking the resource registry, the plone-legacy bundle was not correctly generated because it was not able to find "https://portals.mysite.com/demo-portal/++plone++plone.app.event/event.js" Pulling that resource up directly in the browser is fine. But it did generate this error in the logs:
Traceback (most recent call last):
File "/sprj/st_zope_plone5/plone-st-03/plone5.2/eggs/Zope-4.8.1-py3.8.egg/ZPublisher/BaseRequest.py", line 518, in traverse
subobject = self.traverseName(object, entry_name)
File "/sprj/st_zope_plone5/plone-st-03/plone5.2/eggs/Zope-4.8.1-py3.8.egg/ZPublisher/BaseRequest.py", line 349, in traverseName
ob2 = adapter.publishTraverse(self, name)
File "/sprj/st_zope_plone5/plone-st-03/plone5.2/eggs/Zope-4.8.1-py3.8.egg/ZPublisher/BaseRequest.py", line 136, in publishTraverse
subobject = object[name]
File "/sprj/st_zope_plone5/plone-st-03/plone5.2/eggs/Zope-4.8.1-py3.8.egg/OFS/ObjectManager.py", line 842, in __getitem__
raise KeyError(key)
KeyError: 'demo-portal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/sprj/st_zope_plone5/plone-st-03/plone5.2/eggs/plone.subrequest-1.9.3-py3.8.egg/plone/subrequest/__init__.py", line 153, in subrequest
traversed = request.traverse(path)
File "/sprj/st_zope_plone5/plone-st-03/plone5.2/eggs/Zope-4.8.1-py3.8.egg/ZPublisher/BaseRequest.py", line 535, in traverse
return response.notFoundError(URL)
File "/sprj/st_zope_plone5/plone-st-03/plone5.2/eggs/Zope-4.8.1-py3.8.egg/ZPublisher/HTTPResponse.py", line 819, in notFoundError
raise NotFound(self._error_html(
zExceptions.NotFound: <!DOCTYPE html><html>
<head><title>Site Error</title><meta charset="utf-8" /></head>
<body bgcolor="white">
<h2>Site Error</h2>
<p>An error was encountered while publishing this resource.
</p>
<p><strong>Resource not found</strong></p>
Sorry, the requested resource does not exist.<p>Check the URL and try again.</p><p><b>Resource:</b> https://portals.mysite.com/demo-portal/demo-portal</p>
<hr noshade="noshade"/>
<p>Troubleshooting Suggestions</p>
<ul>
<li>The URL may be incorrect.</li>
<li>The parameters passed to this resource may be incorrect.</li>
<li>A resource that this resource relies on may be
encountering an error.</li>
</ul>
<p>If the error persists please contact the site maintainer.
Thank you for your patience.
</p></body></html>
Note that it doubles "demo-portal" for some reason. Debugging at this point in plone.subrequest I see that when passed url=https://portals.mysite.com/demo-portal/++plone++plone.app.event/event.js
the value of path
is '/VirtualHostBase/https/portals.mysite.com:443/db01/plone_demo/VirtualHostRoot/_vh_demo-portal//demo-portal/++plone++plone.app.event/event.js'
.
It's obviously an issue with how the VH is resolved but is the problem with my apache config? bug in plone.subrequest? I have not been able to find any guides on Apache setups for Plone where the site is not hosted on the domain root (we have multiple Plone sites one path deep on this domain), if anyone can give me a reference that would be great.