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

Feature Request: BASE_URL Support for Speedtest Tracker #1563

Open
soakes opened this issue Jun 22, 2024 · 6 comments
Open

Feature Request: BASE_URL Support for Speedtest Tracker #1563

soakes opened this issue Jun 22, 2024 · 6 comments
Assignees
Labels
🎉 feature New feature or request
Milestone

Comments

@soakes
Copy link

soakes commented Jun 22, 2024

Feature Request: BASE_URL Support for Speedtest Tracker

Is your feature request related to a problem? Please describe.

Currently, Speedtest Tracker does not support a BASE_URL configuration option. This presents a problem when the app is deployed behind a reverse proxy with a path prefix (e.g., /tracker), as the app does not properly redirect URLs to reflect this setup.

Describe the solution you'd like

I would like to see support for a BASE_URL configuration parameter in Speedtest Tracker. This feature would allow administrators to specify a base URL path (e.g., /tracker) where the app is hosted behind a reverse proxy. With this enhancement, all internal app URLs would correctly reflect the base URL, ensuring proper navigation and functionality without manual adjustments.

Additional context

Currently, when Speedtest Tracker is accessed through a reverse proxy at a path like /tracker, the URLs generated by the app do not account for this prefix. This leads to broken links and incorrect redirections within the application. Adding a BASE_URL setting would mitigate these issues by dynamically adjusting internal URLs based on the configured base path (/tracker in this example).

This feature is crucial for seamless integration of Speedtest Tracker into environments where reverse proxies and URL prefixes are standard practices for security and organizational reasons.

@alexjustesen alexjustesen added the 🎉 feature New feature or request label Jun 22, 2024
@alexjustesen alexjustesen added this to the v1.x.x milestone Jun 22, 2024
@Berserkir-Wolf
Copy link

I second this one - it would be brilliant for those of us who expose things behind SSL proxies.

@alexjustesen
Copy link
Owner

alexjustesen commented Jun 24, 2024

You should be able to update your APP_URL to include the subdirectory postfix, something along the lines of APP_URL: 'to-my-domain.tld/speedy', if that works feel free to confirm and I'll add it to the docs. I run subdomains so I don't have a way to test it.

@soakes
Copy link
Author

soakes commented Jun 24, 2024

Thanks @alexjustesen will give this a try shortly and will update this message with the results.

Update
Unfortunately I get an "custom" 404 which is coming from the container.

image

Also I did look for something like APP_URL on the docs @ https://docs.linuxserver.io/images/docker-speedtest-tracker/#usage and you can see its not mentioned. Which is why I originally created this as I thought it wasn't supported.

Update
So this is very intresting, while APP_URL is set correctly i.e speedtest.example.com/tracker - looking at k8s pods, I am seeing it 'without' the /tracker.

Containers:
  speedtest-tracker:
    Container ID:   containerd://8eb2b436b9ea8152095b23677305de4fca7eb10b4911f9800e3188b094930b01
    Image:          lscr.io/linuxserver/speedtest-tracker@sha256:ccb1793cdc9a2e7fdf985823ab92ba71058791834197b1de5364a5b23700011e
    Image ID:       lscr.io/linuxserver/speedtest-tracker@sha256:ccb1793cdc9a2e7fdf985823ab92ba71058791834197b1de5364a5b23700011e
    Port:           80/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Tue, 25 Jun 2024 00:59:44 +0100
    Ready:          True
    Restart Count:  0
    Environment:
      PUID:                      1000
      PGID:                      1000
      TZ:                        Etc/UTC
      MAIL_MAILER:               smtp
      MAIL_HOST:                 mail.example.com
      MAIL_PORT:                 465
      MAIL_ENCRYPTION:           tls
      MAIL_USERNAME:             <set to the key 'username' in secret 'speedtest-tracker-smtp-creds-k6ht9hk2tc'>  Optional: false
      MAIL_PASSWORD:             <set to the key 'password' in secret 'speedtest-tracker-smtp-creds-k6ht9hk2tc'>  Optional: false
      DB_CONNECTION:             mysql
      DB_HOST:                   <set to the key 'mysql_host' in secret 'speedtest-tracker-db-creds-dt2tggm687'>  Optional: false
      DB_PORT:                   3306
      DB_DATABASE:               <set to the key 'mysql_db' in secret 'speedtest-tracker-db-creds-dt2tggm687'>        Optional: false
      DB_USERNAME:               <set to the key 'mysql_user' in secret 'speedtest-tracker-db-creds-dt2tggm687'>      Optional: false
      DB_PASSWORD:               <set to the key 'mysql_password' in secret 'speedtest-tracker-db-creds-dt2tggm687'>  Optional: false
      DISPLAY_TIMEZONE:          Europe/London
      PRUNE_RESULTS_OLDER_THAN:  0
      APP_KEY:                   <set to the key 'app_key' in secret 'speedtest-tracker-app-creds-55fdm462mf'>  Optional: false
      APP_URL:                   https://speedtest.example.com
      SPEEDTEST_SCHEDULE:        15 5 */1 * *
      SPEEDTEST_SERVERS:         23389
      MAIL_FROM_NAME:            Speedtest Tracker
      MAIL_FROM_ADDRESS:         [email protected]

I have tried single and even double quotes over the url, didnt help. Strange.

Could someone else also test to make sure its not k8s platform, thanks.

Update

Have also confirmed inside the pod, its set worng.

root@speedtest-tracker-789d49b8d4-xgjbk:/# env|grep -i URL
APP_URL=https://speedtest.example.com

Are we sure its not being overrdden?

Update

Confirmed, theres a problem in the code somewhere. Removing the APP_URL completly, I am still seeing the APP_URL being set. I believe your setting this and not accepting if a custom ENV has been set by the end user.

Update

I have also confirmed its not a k8s issue, I just added to another container and as you can see, its set correctly.

   Environment:
      APP_URL:                       example.com/tracker

I am 99% certain now that there is a problem in the code and something is overwriting whats been set by the end user. @alexjustesen would you mind taking a look when you get a few minutes, thank you.

I don't mind testing anytime, just ping me :)

@alexjustesen alexjustesen self-assigned this Jun 24, 2024
@alexjustesen
Copy link
Owner

Dropping this here for later Alex...

https://gist.github.com/rafaucau/8259400871607bfb0826ba7f40b28474

@alnviana
Copy link

This comment may be useful: laravel/framework#51210 (comment)

I tested it here, putting it right after the HTTPS check allows me to access the login screen by just going to http://fqdn/subfolder/, but it gives error 405 when I try to log in. :/

@mircsicz
Copy link

I (obvisously) won't be able to go through this gist tomorrow but plan to do so in the coming days:
https://gist.github.com/luttje/689290ad45dc564cd2d3270b0bbac381

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

No branches or pull requests

5 participants