Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

folder_contents broken in Plone 5.0.5 for sites using virtual hosting #103

Closed
marwoe opened this issue Aug 11, 2016 · 10 comments
Closed

folder_contents broken in Plone 5.0.5 for sites using virtual hosting #103

marwoe opened this issue Aug 11, 2016 · 10 comments

Comments

@marwoe
Copy link

marwoe commented Aug 11, 2016

It seems that the folder_contents is broken in Plone 5.0.5 for sites with virtual hosting environments.
With Plone 5.0.4 everything is ok.
Pinning the version of plone.app.content to 3.0.20 for Plone 5.0.5 works.

Traceback (innermost last):
  Module ZPublisher.Publish, line 138, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 48, in call_object
  Module plone.app.content.browser.contents, line 275, in __call__
  Module plone.app.content.browser.contents, line 233, in get_options
  Module plone.app.content.browser.contents, line 65, in get_top_site_from_url
  Module ZPublisher.HTTPRequest, line 280, in physicalPathFromURL
ValueError: Url does not match virtual hosting context
@thet
Copy link
Member

thet commented Aug 27, 2016

Can you give more context on how you configured your virtual hosting environment?

I use plone.app.content 3.1.x in a Plone 5.1 environment with a nginx setup like this:

server {
    listen 1.2.3.4:80;
    server_name domain.net;
    location / {
        proxy_pass http://localhost:8080/VirtualHostBase/http/domain.net:80/Plone/VirtualHostRoot/;
    }
}

Can someone confirm? Does this error also exist in Plone 5.1?
If this error is specific to Plone 5.0, then we should fixate the version to plone.app.content < 3.1 for Plone 5.0.
I'm using plone.app.content 3.1.x for Plone 5.1 with Lineage subsites and virtual hosting environments without any problem.

The mentioned error comes from this PR, which I submitted: #87

@thet
Copy link
Member

thet commented Aug 27, 2016

/cc @esteele

@vangheem
Copy link
Member

I don't think #87 has anything to do with it. I've been running with vhm for a long time.

@marwoe
Copy link
Author

marwoe commented Aug 30, 2016

We use HAProxy and Apache rewrite rules like

RewriteRule ^/mysite(.*)  http://127.0.0.1:7070/VirtualHostBase/http/www.my-domain.de:80/Plone/VirtualHostRoot/_vh_mysite$1

Our environment hasn't changed in the recent past.
I tried out Plone 5.1a2 - same problem, folder_contents is broken.

@quarquar
Copy link

I have the same issue.

RewriteRule ^/mydir(.*) http://127.0.0.1:8080/VirtualHostBase/http/%{SERVER_NAME}:80/mydir/mydir/VirtualHostRoot/_vh_mydir$1 [L,P]

Plone version 5.0.5

I have the same rule in a previous version and works without problem.

@cip22
Copy link

cip22 commented Sep 10, 2016

Same thing here.
Problem seems to be get_top_site_from_url().
In the case of Virtual hosting which roots to a subsite, ZPublisher.HTTPRequest.physicalPathFromURL first gets a '/' which doesn't match the virtual hosting configuration, so an error is thrown. Couldn't check further. My workaround (for a one-site installation) is to let get_top_site_from_url return getSite() and ignore the loop.

@ghost
Copy link

ghost commented Oct 3, 2016

This is a major breaker for us, contents page does not work on any of our sites.

thet added a commit that referenced this issue Oct 7, 2016
Fix issue with ``get_top_site_from_url``, where in some circumstances a ValueError was thrown.
If that happens, just return ``getSite``.
You will only notice, if you have subsites, access them non-VirtualHost-rooted and an error is thrown.
Then folder contents won't be able to navigate up to the root Plone site.
Fixes #103.
@thet
Copy link
Member

thet commented Oct 7, 2016

I created a fix for this issue. After tests go green, we should release ASAP and include in Plone 5.0.x and 5.1.x.
Dear people, please try this fix. I cannot reproduce your problem, so it's up to you to test it.

@thet thet closed this as completed in #110 Oct 7, 2016
thet added a commit that referenced this issue Oct 7, 2016
Fix get_top_site_from_url, Issue #103.
tomgross pushed a commit that referenced this issue Oct 24, 2016
Fix issue with ``get_top_site_from_url``, where in some circumstances a ValueError was thrown.
If that happens, just return ``getSite``.
You will only notice, if you have subsites, access them non-VirtualHost-rooted and an error is thrown.
Then folder contents won't be able to navigate up to the root Plone site.
Fixes #103.
@flipmcf
Copy link

flipmcf commented Oct 23, 2018

I'm re-creating this in Plone 5.0.5 - specifically #159 describes the problem very well.

@Rudd-O
Copy link

Rudd-O commented Sep 7, 2022

I think this fix is what broke #159 perhaps? I know it works now... unless you use VHM + Multilingual.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants