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

MythWeb - protocol relative URL in the HTML - easier to use SSL with a reverse proxy like nginx #846

Open
SaveFerrisVote4Pedro opened this issue Jan 16, 2024 · 3 comments

Comments

@SaveFerrisVote4Pedro
Copy link

A few code changes in MythWeb will change the URLs to protocol relative URLs. This makes it much easier to put MythWeb behind a reverse proxy (like nginx) and add the security of SSL certificates.

In a rendered page of MythWeb, the output includes links written like this

<link rel="stylesheet" type="text/css" href="http://my_myth_tv_server/mythweb/skins/default/style.css">

This breaks behind a nginx reverse proxy (which I use to give myself secure access using SSL), so my MythWeb page looks like this:

https://imgur.com/a/lQqR4Cp

They should have the http: removed, so they look like this in the HTML:

<link rel="stylesheet" type="text/css" href="//my_myth_tv_server/mythweb/skins/default/style.css">

That is there should be no http:// in the URL, it should just be //

This would mean that the generated HTML will render correctly regardless of whether the MythWeb is hosted on a http or https webserver.

All that needs to be changed is this line in /usr/share/mythtv/mythweb/includes/defines.php

$root_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';

Becomes

$root_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? '//' : '//';

Obviously there's a more elegant way of doing this, but I'm not a php expert. I figured this out with a bit of trial and error.

My version of MythTV

/mythbuntu/33/ubuntu jammy/main amd64 mythweb all 2:33.1+fixes.202401131706.512d723c83~ubuntu22.04.1

It is a simple fix, it won't break MythWeb for anyone, but it will help me not having to go in and edit defines.php everytime MythWeb is updated 😉

@bennettpeter
Copy link
Member

MythTV version 34 has a new web app that has all of the function of mythweb at http://backend:6544. You can try that now on the master version of mythbackend and let me know if any change is needed to support the reverse proxy.

@SaveFerrisVote4Pedro
Copy link
Author

Quick reply Peter! Does the v34 look similar to this on v33?

Screenshot 2024-01-19 184924

I don't mind this, but I like a direct URL to TV listings etc

Not just staying on http://192.168.1.234:6544/# no matter where you navigate,

MythWeb updates URLs (eg., from https://my_myth_tv_server/mythweb/tv/list and https://my_myth_tv_server/mythweb/tv/recorded) which I prefer

Call me old fashioned! 😎

@bennettpeter
Copy link
Member

The V34 app is completely rewritten. In V34 the program guide URL is http://backend:6544/dashboard/program-guide.
Screenshot_2024-01-19_09-08-28

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

No branches or pull requests

2 participants