Firstly, I should say that it is technically impossible to do what you're asking. There are always ways around, even if by proxying your stream server-side. However, you can make a reasonable effort by validating the Referer
header when a client connects.
When the browser connects to Icecast to retrieve the stream, it includes the Referer:
header, indicating the URL the user is accessing the stream from. For example:
Referer: https://blog.example.com/
As far as I know, stock Icecast has no capability to check this header for you. It does however have authentication hooks, which will allow you to validate the header in your own scripts, by calling their URL and reading its response. So, in your Icecast config, you would include something like:
<mount>
<mount-name>/stream</mount-name>
<authentication type="url">
<option name="stream_auth" value="https://blog.example.com/icecast-auth-script.php" />
<option name="headers" value="referer" />
<option name="requestHeader." />
</authentication>
</mount>
Then, in your PHP script, you can take a look at something like $_POST['requestHeader.referer']
. If it matches what you want, tell Icecast to approve the stream:
header('icecast-auth-user: 1');