Horizon HTTPS redirects are incorrect

Bug #1593405 reported by Dmitry Ilyin
18
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Mirantis OpenStack
Confirmed
Low
Dmitry Ilyin
9.x
Fix Released
Low
Max Yatsenko

Bug Description

When SSL is enabled users are redirected from the HTTP URLs to the HTTPS ones.

* If a user tries to connect to the HTTP URL and tries to get "/" the HAProxy backend will send a redirect to to the port 443 and "/" too.
* This connection is able to bypass the first redirection and makes its way through the HAProxt SSL termination to the Apache backend without SSL.
* The request is redirected again by the rule: "RedirectMatch permanent ^/$ /horizon" but is sent
to the URL http://${host}/horizon (without ssl again) because the backend is not SSL enabled and redirect keeps the protocol of the request.
* Then, this request again is bounced by the HAProxy backend to https://${host}/horizon
* Finally, this request is able to reach Horizon and is redirected to the login page.

* http://10.20.1.2
* https://10.20.1.2
* http://10.20.1.2/horizon <- http again
* https://10.20.1.2/horizon
* https://10.109.1.2/horizon/auth/login/?next=/ <- login page

This chain of redirects will break if only the port 443 is opened or forwarded and the client is not able to connect when he is asked to go to http again, provided the first request was to the https://10.20.1.2. The browser will show Connection Reset error and Horizon will not be available.

Dmitry Ilyin (idv1985)
Changed in fuel:
importance: Undecided → Medium
status: New → Confirmed
milestone: none → 10.0
assignee: nobody → Dmitry Ilyin (idv1985)
Revision history for this message
Bug Checker Bot (bug-checker) wrote : Autochecker

(This check performed automatically)
Please, make sure that bug description contains the following sections filled in with the appropriate data related to the bug you are describing:

actual result

version

expected result

steps to reproduce

For more detailed information on the contents of each of the listed sections see https://wiki.openstack.org/wiki/Fuel/How_to_contribute#Here_is_how_you_file_a_bug

tags: added: need-info
Revision history for this message
Dmitry Ilyin (idv1985) wrote :

  # This rule is not aware of the connection being made over HTTPS
  # RedirectMatch permanent ^/$ "https://10.109.3.3/horizon"

  # These rewrite rules would work better by always sending a user to the https url
  # and keeping a custom port id the port forwarding is being used.
  RewriteEngine On

  RewriteCond %{SERVER_PORT} ^80$
  RewriteRule ^/$ https://%{SERVER_NAME}/horizon [R=301,L]

  RewriteRule ^/$ https://%{SERVER_NAME}:%{SERVER_PORT}/horizon [R=301,L]

  # The wsgi class of the horizon module is being used in no-ssl mode and is not aware of the SSL
  # termination on the HAProxy.

  # This rules cannot be easily applied to the library because it will require to make
  # modification to the upstream Horizon module and, possibly, the upstream apache module.

* Also the redirecting haproxy backend should have "code 301" to send a permanent redirect instead of a temporary one.

tags: added: 10.0-reviewed
Dmitry Ilyin (idv1985)
Changed in fuel:
importance: Medium → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to fuel-library (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/421996

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to fuel-library (stable/newton)

Related fix proposed to branch: stable/newton
Review: https://review.openstack.org/423282

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to fuel-library (stable/mitaka)

Related fix proposed to branch: stable/mitaka
Review: https://review.openstack.org/423319

affects: fuel → mos
Changed in mos:
milestone: 10.0 → none
Matthew Roark (mroark)
Changed in mos:
milestone: none → 9.x-updates
tags: added: customer-found
Changed in mos:
milestone: 9.x-updates → 10.0
Revision history for this message
Max Yatsenko (myatsenko) wrote :

The following patch was merged:
https://review.openstack.org/#/c/423319/

Dmitry (dtsapikov)
tags: added: on-verification
Revision history for this message
Dmitry (dtsapikov) wrote :

Verified on 9.2+mu3

tags: removed: on-verification
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.