[PR #1797] [MERGED] feat: implement and use new confg key for trusted hosts #1875

Closed
opened 2026-02-26 03:32:38 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/koel/koel/pull/1797
Author: @MichaIng
Created: 7/16/2024
Status: Merged
Merged: 7/16/2024
Merged by: @phanan

Base: masterHead: trusted-hosts


📝 Commits (1)

  • a9673d9 feat: implement and use new confg key for trusted hosts

📊 Changes

3 files changed (+19 additions, -3 deletions)

View changed files

📝 .env.example (+5 -0)
📝 app/Http/Middleware/TrustHosts.php (+1 -3)
📝 config/app.php (+13 -0)

📄 Description

After commit github.com/koel/koel@e969549, Koel accepts only the hostname from APP_URL (and all its sub domains) as trusted hosts, as long as HTTPS is not enforced. This breaks access with .env.example, until APP_URL is set, and then allows to define a single trusted host only, which can be a problem instances which one wants to access from localhost, from within LAN via local hostname or IP, and remotely with a public hostname at the same time, or for testing instances.

This commit introduces a new config key TRUSTED_HOSTS. It is empty by default, which permits access via all hostnames, restoring the pre-v7.0.0 behaviour. When definitng it as comma-separated list of hostnames (and/or IPs), access is restricted to those.

Fixes: #1796


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/koel/koel/pull/1797 **Author:** [@MichaIng](https://github.com/MichaIng) **Created:** 7/16/2024 **Status:** ✅ Merged **Merged:** 7/16/2024 **Merged by:** [@phanan](https://github.com/phanan) **Base:** `master` ← **Head:** `trusted-hosts` --- ### 📝 Commits (1) - [`a9673d9`](https://github.com/koel/koel/commit/a9673d963ca0649becd6e5803f969e8df4e21374) feat: implement and use new confg key for trusted hosts ### 📊 Changes **3 files changed** (+19 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `.env.example` (+5 -0) 📝 `app/Http/Middleware/TrustHosts.php` (+1 -3) 📝 `config/app.php` (+13 -0) </details> ### 📄 Description After commit https://github.com/koel/koel/commit/e969549, Koel accepts only the hostname from `APP_URL` (and all its sub domains) as trusted hosts, as long as HTTPS is not enforced. This breaks access with `.env.example`, until `APP_URL` is set, and then allows to define a single trusted host only, which can be a problem instances which one wants to access from localhost, from within LAN via local hostname or IP, and remotely with a public hostname at the same time, or for testing instances. This commit introduces a new config key `TRUSTED_HOSTS`. It is empty by default, which permits access via all hostnames, restoring the pre-v7.0.0 behaviour. When definitng it as comma-separated list of hostnames (and/or IPs), access is restricted to those. Fixes: #1796 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 03:32:38 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#1875
No description provided.