xdv

Theme not applied using VHM with _vh_ parts

Bug #517244 reported by Tom Switzer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
xdv
Fix Released
Undecided
Marshall Scorcio

Bug Description

The issue is that if you are accessing the site using the VHM and have provided 2 or more _vh_ parts in your virtual path, then xdv fails to theme the domain. Removing the _vh_ parts will fix the problem (but then your links will be broken).

The problem is caused by the fact that if there are at least 2 _vh_ parts of the VH URL, then 'BASE0' will contain all but the last of these parts. For example, accessing:

http://127.0.0.1:8080/VirtualHostBase/http/localhost:80/bar/VirtualHostRoot/_vh_foo/_vh_bar/

Will give a BASE0 of:

http://localhost/foo

However, XDV currently only chops off the scheme part of BASE0, so the location actually remains and must be specified as part of the domain in XDV (eg. localhost/foo). So, when you enter localhost as a domain to theme, it isn't themed because it tries to match localhost against localhost/foo.

I've attached a patch that simply strips off the end of BASE0 as well (everything after and including the first '/').

Another solution (if the current behaviour is actually preferred) may be to simply change the wording in the "Domains" text area so it is clearer that you may need to enter a location as well and/or document this behaviour somewhere.

Steps To Reproduce:

1. Set up collective.xdv to theme localhost
2. Set up Apache to redirect localhost to Plone using VHM, but with a "virtual path" part (using _vh_*) - eg:
 RewriteRule ^/foo/bar/(.*) http://127.0.0.1:8080/VirtualHostBase/http/%{SERVER_NAME}:80/bar/VirtualHostRoot/_vh_foo/_vh_bar/$1 [P]
3. Navigate to http://localhost/foo/bar/

Expected Behaviour: The site will be Themed
Actual Behaviour: It is not themed

Tags: vhm
Revision history for this message
Tom Switzer (thomas-switzer) wrote :
Revision history for this message
Tom Switzer (thomas-switzer) wrote :

FYI: This is for collective.xdv. I was directed here from http://plone.org/products/collective.xdv's Issue Tracker link. Hoping this is the right place.

Changed in xdv:
assignee: nobody → Marshall Scorcio (marshalium)
Revision history for this message
Laurence Rowe (lrowe) wrote :

I think the solution is to change the wording. If you are virtual hosting under http://localhost/foo it should be possible to switch off XDV at http://localhost/bar.

Revision history for this message
Marshall Scorcio (marshalium) wrote :

This does not seem to work consistently enough to just change the wording / document as a feature.

As the reporter said, given the virtual host url: http://127.0.0.1:8080/VirtualHostBase/http/localhost:80/bar/VirtualHostRoot/_vh_foo/_vh_bar/ then BASE0 is http://localhost/foo. But logically it should be http://localhost/foo/bar shouldn't it?

Revision history for this message
Tom Switzer (thomas-switzer) wrote :

Using BASE1 instead of BASE0 would give you http://localhost/foo/bar and I don't think it will affect the original behaviour either.

Revision history for this message
Laurence Rowe (lrowe) wrote :

Looks like BASE1 will work with 1, 2 and 3 levels of virtual hosting, so lest go with that.

Revision history for this message
Tom Switzer (thomas-switzer) wrote :

Just for clarity, using BASE1 will work with any depth of "virtual" paths. So, if you had instead accessed:

http://127.0.0.1:8080/VirtualHostBase/http/localhost:80/bar/VirtualHostRoot/_vh_foo/_vh_bar/_vh_baz/_vh_ilikekittens/

"BASE1" would be: http://localhost/foo/bar/baz/ilikekittens/

Laurence Rowe (lrowe)
Changed in xdv:
status: New → Fix Committed
Laurence Rowe (lrowe)
Changed in xdv:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.