pterodactyl / panel

Pterodactyl® is a free, open-source game server management panel built with PHP, React, and Go. Designed with security in mind, Pterodactyl runs all game servers in isolated Docker containers while exposing a beautiful and intuitive UI to end users.
https://pterodactyl.io
Other
6.81k stars 1.74k forks source link

APP_URL is ignored in blade views leading to broken paths to included files. #1820

Closed credomane closed 4 years ago

credomane commented 4 years ago

Background (please complete the following information):

Describe the bug Installing pterodactyl with APP_URL = https://example.com/pterodactyl/ doesn't work as expected Technically it works but all included files are broken when actually visiting https://example.com/pterodactyl/ because they have incorrect urls.

To Reproduce Steps to reproduce the behavior:

  1. Install pterodactyl as normal
  2. In .env set APP_URL to https://example.com/pterodactyl/
  3. Use any browser to visit https://example.com/pterodactyl/
  4. HTML loads but all included files fail to load.

Expected behavior Pterodactyl to behave as normal.

Proposed Solution I'm linking a gist with a patch file that seems to fix the issue. I've successfully logged in, created a node, imported custom egg, created a server and started/stopped said server. The patch itself.

parkervcp commented 4 years ago

We specifically do not support running pterodactyl as a subfolder setup. We only support domain and subdomain hosting.

credomane commented 4 years ago

I didn't know it was unsupported. Is that in the install docs somewhere? If it is I haven't managed to find it. Would be nice to have this spelled out in the install docs. So someone like me knows it wasn't supported before I went looking into this and working on fixing it. lol. Oh, well.

parkervcp commented 4 years ago

If you fixed it why not PR the fix instead of posting a patch?

sergejostir commented 4 years ago
  1. I really hope you have used a custom directive in your HTTP server's config, otherwise you have just exposed your whole installation to the public via your domain's root.
  2. You have partly broken the package that offers theming functionality (the var is named asset-path with a reason).
  3. PRs for 0.7 branch are not accepted anymore. (https://github.com/pterodactyl/panel/pull/1743#issuecomment-552527226)
credomane commented 4 years ago

Well....That's annoying and rude of you github. Thanks so much for that. I had a response all typed up about ready to post and then sergix's post popped in and github decided to clear out my post. Guess I'll retype it but in notepad this time...grrr.

So I posted a patch file because I wasn't sure if everything was fixed and nothing broken. My understanding of Larvel is quite limited.

I've since noticed a few things. Setting the theme's asset-path to a full url breaks some stuff in the blade templates. Namely the include paths for keyboard.pollyfill.js, laroute.js, and autocomplete.js as sergix mentions.

Some AJAX requests fail because they aren't using the APP_PATH. I'm not really sure where to go about attempting to fix those.

It would be nice if at some point pterodactyl could support subfolder installation but with 0.7.x series in maintenance mode there is no point in continuing to fix this on this version. Plus to fully support subfolders a whole lot more needs changed/fixing than just some paths. As sergix said there is a lot of private things that are easily exposed right now if you just throw pterodactyl into a subfolder (and don't alias like I did.

@sergix I aliased /ptero to /var/www/pterodactyl/public/. The actual domain root resides elsewhere so no exposing of private things.

sergejostir commented 4 years ago

Oh yeah, laroute (which is used for routing AJAX requests) is also configured to use relative URLs, so you would need to change that in laroute.php config and then generate a new file.

May I ask why you do not simply have a dedicated subdomain for your panel?

PS: You tagged a wrong user ;)

DaneEveritt commented 4 years ago

This is working as intended, subdirectory installation is not supported.

Sergix commented 4 years ago

@sergiz @DaneEveritt Definitely was confused when I got a notification from this thread, but thanks for doing so because this project is actually really neat! :smile: