CentOS 7.4 Plone 5.1 Apache 2.4.6 VHM dynamic rewrite & mapping doesn't work correctly using needed wildcards (40 sites, 190 domains)

Greetings, pulling my hair our trying to get Plone 5.1 to work with apache rewriterule on CentOS 7.4. Wondering if it is a CentOS -ism? But not sure if it is a bug in Plone 5 on CentOS?

The exact same rewrite rule that works on my Suse server and Ubuntu server, does not work on the CentOS (new) server, same with straight from the Plone 5.1 docs (for ubuntu): https://docs.plone.org/manage/deploying/front-end/apache.html

the rewrite syntax: https://pastebin.com/pKnH2Z4W

with /Plone/ portion included, wont' work at all (resource not found). If I remove the /Plone/ portion, then just serves the root of the Plone instance for all the sites.

This is to host about 40 sites, with about 190 domains. The docs in 5.1 say I have to create separate config file for each and every domain. Please tell me that is now now the standard?

Wilfcard approach includes either SERVER_HOST (older version) or HTTP_HOST (newer version) (desired but not working on this server combo): %{HTTP_HOST} instead of manually coded /rpgbus

If I take out the /Plone portion, then redirect 8080 to 80 works for the wildcard domains, but I have to add the /domain (for example www.rpgbus.com/rpgbus if just www.rpgbus.com will just serve the root Plone

Serving the web, and trial an error, I have tried 46 different variations in syntax, from examples dating from 2009 to 2017, none quite get me there. It looks like CentOS is refusing to pass the /plone variable to the end from enabling detailed debugging rewrite engine. Here is output just hitting www.rpgbus.com which then just serves up the root of the plone instance: https://pastebin.com/ZES5Ddcn And here is what the logs show if hitting

http://www.rpgbus.com/rpgbus https://pastebin.com/afDhxpCi Setting up mappings in VHM doesn't seem to make any difference one way or the other either.

I can get one site to work if I hard code each Plone site manually, but previous versions worked with the wildcarded no problem. Any ideas?

Thanks for any suggestions.

Example with wildcards that no longer works correctly: RewriteRule ^/(.*) http://localhost:8080/VirtualHostBase/http/%{HTTP_HOST}:80/VirtualHostRoot/$1 [P,L]

Example with manual listing that works ONLY FOR THAT URL/DOMAIN (undesired approach): RewriteRule ^/(.*) http://localhost:8080/VirtualHostBase/http/www.rpgbus.com:80/rpgbus/VirtualHostRoot/$1 [P,L]

Please tell me I don't have to create 190 to 380+ .conf files, and there is a way to get wildcard working again.
Thanks!

Nothing has change on this in the last years.
The only way the wildcard could work is if you used to set the mapping in the VHM Mapping view in the Zope root. (domain -> Plone object)

If you do not want to do that, then you'll have create a file per site and add all the vhost configs there.
No need to do one file per domain. Make sure you only have one domain per site, and that you redirect all aliases so you don't get duplicate content in google/bing/altavista.

Alas, that is part of what appears to not be working, the VHM part. I have the mappings all in place, but they only work if the rewrite rule is explicity, not when wildcarded.
VHM mapping for one example site:

> rpgbus.com/rpgbus
> www.rpgbus.com/rpgbus

Here is output of client1/Z2.log when hitting www.rpgbus.com with wildcarded rewrite rule and VHM maps as above:

https://pastebin.com/f1qNDiiu

Here is output of client1/event.log

------
2018-07-12T09:12:08 ERROR Zope.SiteErrorLog 1531411928.480.831798249415 http://
Traceback (innermost last):
  Module ZPublisher.Publish, line 127, in publish
  Module ZPublisher.BaseRequest, line 548, in traverse
IndexError: list index out of range
------
2018-07-12T09:12:08 ERROR Zope.SiteErrorLog 1531411928.620.0230871827302 http://
Traceback (innermost last):
  Module ZPublisher.Publish, line 127, in publish
  Module ZPublisher.BaseRequest, line 548, in traverse
IndexError: list index out of range

More detailed log for above here: https://pastebin.com/erRWQiKz

Whereas with the hardcoded rewriterule for that domain (Rather than wildcard), I do not get an error in event.log of any kind, and the Z2.log is just: https://pastebin.com/aSuxfRFE

Do I need to crank up Plone debugging to get more info about why the reference is out of index for VHM?

Maybe this is key info?

2018-07-12T09:10:29 ERROR ZPublisher BeforeTraverse: Error while invoking hook: "virtual_hosting"
Traceback (most recent call last):
  File "/opt/plone/buildout-cache/eggs/Zope2-2.13.27-py2.7.egg/ZPublisher/BeforeTraverse.py", line 143, in __call__
    meth(*(container, request, None)[:args])
  File "/opt/plone/buildout-cache/eggs/Zope2-2.13.27-py2.7.egg/Products/SiteAccess/VirtualHostMonster.py", line 154, in __call__
    host, port = host.split(':')
ValueError: too many values to unpack
------
2018-07-12T09:10:59 ERROR ZPublisher BeforeTraverse: Error while invoking hook: "virtual_hosting"
Traceback (most recent call last):
  File "/opt/plone/buildout-cache/eggs/Zope2-2.13.27-py2.7.egg/ZPublisher/BeforeTraverse.py", line 143, in __call__
    meth(*(container, request, None)[:args])
  File "/opt/plone/buildout-cache/eggs/Zope2-2.13.27-py2.7.egg/Products/SiteAccess/VirtualHostMonster.py", line 154, in __call__
    host, port = host.split(':')
ValueError: too many values to unpack

If you use the Mapping stuff, then you do not use URL rewriting (https://docs.zope.org/zope2/zope2book/VirtualHosting.html#virtual-host-monster-mappings-tab).

Just proxy directly to the Zope instance, but make sure you'll pass in the hostname.

Or, just make 40 files (one per site) and rewrite as normal. It's just 190 domains, debugging this will take you way longer.

Understood. That was going to be my last resort. If it is a bug (as it seems compared to previous versions functioning), then I was willing to help track down so that it could be fixed. I just had hoped it would be fixable. Unless you are saying this is an international change in how it works compared to previous versions, is not a bug, and is working as desired by the Plone developers for 5.x?

No, there are no changes in this area.

If you have a setup with wildcards that works with Plone < 5.1, then I'd be interested in seeing that.

I used the same syntax from my 4.3 server. However, it is a very long, messy .conf, and I am wondering if there is something else in there that was making it work. Going to check based on your feedback to see if it was some other declaration (of many in the older long .conf file). Because if it didn't change, then I missed something in the old setup that was making it much easier than having to create these 40 .conf files in this new setup. I'll get back to you on that.

Plone Foundation Code of Conduct