Rudloff / alltube

Web GUI for youtube-dl
GNU General Public License v3.0
2.96k stars 582 forks source link

Provide basePath support #309

Closed bellington3 closed 3 years ago

bellington3 commented 3 years ago

To be able to serve the application via a reverse proxy in a subfolder smarty needs to be aware of the basepath if any.

Rudloff commented 3 years ago

I'm not sure I understand why this is needed.

On Apache, {base_url} contains the path. If this is not the case on Nginx, we should fix that instead of adding a setting. The URI is passed to Smarty here: https://github.com/Rudloff/alltube/blob/e337145c750cde4ee57b56796f3575154899ea67/classes/ViewFactory.php#L43

Does the $request object not contain the path for you?

bellington3 commented 3 years ago

Yes it does, aka $request->getUri() returns it but if i do not set it as defined I always get a page not found if I request /alltube. This addresses what has been asked months ago (and never answered) here https://github.com/Rudloff/alltube/issues/295 .

Maybe as clarification: I am not replacing the apache in the alltube container, i have a nginx "before" that to route requests that come to https://mydomain.com/alltube to the container.

Rudloff commented 3 years ago

I could reproduce the issue with an Apache reverse proxy. (I don't use Nginx.) However, I am not very confortable with setting the port and path manually.

IMHO, a cleaner way to fix this would be to make the reverse proxy set X-Forwarded-Host, X-Forwarded-Port and X-Forwarded-Path then use them in Alltube.

bellington3 commented 3 years ago

Yeh thats what I tried first but for some reason I didnt receive the headers in the $request->getHeader(..). Maybe I was missing something, might try again later.

bellington3 commented 3 years ago

I implemented it based on the X-Forwarded headers now. I suggest to squash the commits prior to merging (would you do this or me)?

Rudloff commented 3 years ago

I suggest to squash the commits prior to merging (would you do this or me)?

Don't worry, I can squash when merging.