Plone 5.2.0 with Python 3.7.6 on Linux

Hi, Bitnami Engineer here,

As you may know, Bitnami's goal is to offer open-source software up-to-date and running on any laptop, platform, or cloud. We are working on upgrading the Python version of Plone 5.2.0 from 3.7.4 to 3.7.6 but we are facing some issues after configuring it with Apache (version 2.4.41). The URLs generated by Plone are including both the Apache and Plone ports, which are invalids. Apache runs on port 8080, while Plone can be reached on port 8081.

# Accesing Plone through Apache
$ curl "http://127.0.0.1:8080/plone"
...
  <footer>
    <p>
      <a href="http://127.0.0.1:8080:8081/plone/manage_main" title="Go to the ZMI">Management Interface</a>
      <span>&#151; low-level technical configuration.</span>
    </p>
    <p>
      <span>For an introduction to Plone, success stories, demos, providers, visit</span>
      <a href="http://plone.com" title="Plone.com" target="_blank">plone.com</a>.
    </p>
    <p>
      <span>For documentation, add-ons, support, community, visit</span>
      <a href="http://plone.org" title="Plone Community Home">plone.org</a>.
    </p>
  </footer>
</div>
</body>
</html>

If we visit Plone directly, without Apache, URLs are properly generated.

# Accessing plone directly
$ curl "http://127.0.0.1:8081"
...
  <footer>
    <p>
      <a href="http://127.0.0.1:8081/manage_main" title="Go to the ZMI">Management Interface</a>
      <span>&#151; low-level technical configuration.</span>
    </p>
    <p>
      <span>For an introduction to Plone, success stories, demos, providers, visit</span>
      <a href="http://plone.com" title="Plone.com" target="_blank">plone.com</a>.
    </p>
    <p>
      <span>For documentation, add-ons, support, community, visit</span>
      <a href="http://plone.org" title="Plone Community Home">plone.org</a>.
    </p>
  </footer>
</div>
</body>
</html>

It doesn't happen when using Python 3.7.4. Can you tell us if this is a known issue or if Python 3.7.6 is not officially supported yet? According to the requirements page, we understand it is

https://docs.plone.org/manage/installing/requirements.html#python

Regards,
Gonzalo

Hi Gonzalo,

I'm guessing there's something off with your RewriteRule.

It should be something like this, where http://localhost:8080 is your Plone server, /http/ is the public url's protocol, and :8080/ is the public port.
RewriteRule ^/(.*) http://localhost:8080/VirtualHostBase/http/%{HTTP_HOST}:8080/Plone/VirtualHostRoot/$1 [P,L]

https://docs.plone.org/manage/deploying/front-end/apache.html

Hope this helps!

1 Like

Hi @jaroel,

Thanks for checking it. Our current RewriteRule for HTTP is

RewriteRule ^/plone($|/.*) http://127.0.0.1:8081/VirtualHostBase/http/%{SERVER_NAME}:8080/VirtualHostRoot/_vh_plone$1 [L,P]

We replaced it with the one you suggested and we continue having this issue. We also replaced the first part of the RewriteRule with http://localhost:8081 that is where Plone is listening.

We even run curl against the final RewriteRule URL and we only get the wrong URLs with Python 3.7.6. When using Python 3.7.4 URLs are properly generated

  • Python 3.7.4
 $ curl http://127.0.0.1:8081/VirtualHostBase/http/127.0.0.1:8080/VirtualHostRoot/
...
<img src="http://127.0.0.1:8080/++resource++plone-logo.png" width="108" height="28" alt="Plone"/>
...
  • Python 3.7.6
$ curl http://127.0.0.1:8081/VirtualHostBase/http/127.0.0.1:8080/VirtualHostRoot/
...
<img src="http://127.0.0.1:8080:8081/++resource++plone-logo.png" width="108" height="28" alt="Plone"/>
...

Whelp, that's something I've never seen before.

Are you sure that

SERVER_NAME

is always the same?

Hi @yurj,

Thanks for your suggestion, but replacing SERVER_NAME with HTTP_HOST produces the same output. We are also running curl directly against Plone (port 8081) in the commands from my previous post, so Apache is not affecting the results. The only difference between them is the Python version.

Hi @gonzalo,
seems that there is a different behavior when parsing a wrong URL, without a scheme, with urlparse:

Python 3.7.5

>>> from six.moves.urllib.parse import urlparse
>>> urlparse('127.0.0.1:8080')
ParseResult(scheme='', netloc='', path='127.0.0.1:8080', params='', query='', fragment='')

Python 3.7.6

>>> from six.moves.urllib.parse import urlparse
>>> urlparse('127.0.0.1:8080')
ParseResult(scheme='127.0.0.1', netloc='', path='8080', params='', query='', fragment='')

Different behavior that produces the differences that you have experimented:

Zope 4.1.1 w/ python 3.7.5

>>> from ZPublisher.HTTPRequest import splitport
>>> splitport('127.0.0.1:8080')
('127.0.0.1', 8080)

Zope 4.1.1 w/ python 3.7.6

>>> from ZPublisher.HTTPRequest import splitport
>>> splitport('127.0.0.1:8080')
('127.0.0.1:8080', None)

IMHO there is an easy and simple solution: upgrade to Plone 5.2.1/Zope 4.1.3 (... or monkey-patching this function https://github.com/zopefoundation/Zope/blob/4.1.1/src/ZPublisher/HTTPRequest.py#L110).

2 Likes

Hi @mamico,

Thanks for your help. I tested Plone 5.2.1 with Python 3.7.6 and it is working fine now.

Regarding the Plone releases, could you tell me if you consider the current Plone-5.2.1-UnifiedInstaller-r3.tgz release stable? I'm asking because for previous version, I see you released a Plone-5.2.0-UnifiedInstaller.tgz version that looked as the stable release, but I'm not sure if these "revision" releases are fine to be used or not. Could you tell me more about your release policy or give me more information about the meaning of the -r* suffix?

Plone Foundation Code of Conduct