Bug 55785 - Portal does not properly detect protocol type
Portal does not properly detect protocol type
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Portal
UCS 5.0
Other Windows NT
: P5 normal (vote)
: UCS 5.0-4-errata
Assigned To: Florian Best
Christian Castens
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2023-03-06 10:55 CET by Thorsten
Modified: 2023-07-05 14:48 CEST (History)
4 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 2: Improvement: Would be a product improvement
Who will be affected by this bug?: 1: Will affect a very few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.023
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thorsten univentionstaff 2023-03-06 10:55:47 CET
Components like the central navigation do not create the correct links (starting with https) as the portal does not analyse correctly the protocol in use to set these links correctly. This probably also affects the link selection when adding http / https mixed links to a portal entry.

Florian already provided a fix for the issue that was successfully tested regarding the above mentioned problem with the central navigation.

index e0f90e14c6..0023f1c434 100755
--- management/univention-portal/univention-portal-server
+++ management/univention-portal/univention-portal-server
@@ -52,6 +52,11 @@ class PortalResource(tornado.web.RequestHandler):
        def initialize(self, portals):
                self.portals = portals

+       def prepare(self, *args, **kwargs):
+               super().prepare(*args, **kwargs)
+               self.request.headers.get('X-UMC-HTTPS') == 'on':
+                       self.request.protocol = 'https'
+
        def write_error(self, status_code, **kwargs):
                if "exc_info" in kwargs:
                        get_logger("server").exception("Error during service")
Comment 2 Dirk Wiesenthal univentionstaff 2023-06-28 15:36:07 CEST
How do we test whether this works?
Comment 4 Florian Best univentionstaff 2023-07-03 16:26:10 CEST
96bfbcf455 | fix(portal): HTTPS detection when acessing navigation.json endpoint behind UCS apache reverse proxy

QA: the following command should give https based URLs, not http-based:
# curl -sk  https://Administrator:univention@localhost/univention/portal/navigation.json | python -m json.tool | grep -e icon_url -e link
                    "icon_url": "https://localhost/univention/portal/icons/entries/login-ucs.svg",
                    "link": "https://localhost/univention/login/?location=/univention/portal/",
                    "icon_url": "https://localhost/univention/portal/icons/entries/umc-domain.svg",
                    "link": "https://localhost/univention/umc/",
Comment 5 Christian Castens univentionstaff 2023-07-03 17:18:08 CEST
QA:
 - correct HTTPS links are created: OK
 - yaml: OK
 - no related traceback/errors in logfiles: OK
Comment 6 Christian Castens univentionstaff 2023-07-05 14:48:53 CEST
<https://errata.software-univention.de/#/?erratum=5.0x726>