EXT-X-DEFINE: how to implement QUERYPARAM on iOS 16.5+

I have a stream.m3u8 file with the following contents:

#EXTM3U
#EXT-X-VERSION:11

#EXT-X-DEFINE:QUERYPARAM="token"
#EXT-X-STREAM-INF:BANDWIDTH=400000,RESOLUTION=640x360
360.m3u8{$token}

#EXT-X-DEFINE:QUERYPARAM="token"
#EXT-X-STREAM-INF:BANDWIDTH=1000000,RESOLUTION=960x540
540.m3u8{$token}

#EXT-X-STREAM-INF:BANDWIDTH=2000000,RESOLUTION=1280x720
#EXT-X-DEFINE:QUERYPARAM="token"
720.m3u8{$token}

#EXT-X-STREAM-INF:BANDWIDTH=8000000,RESOLUTION=1920x1080
#EXT-X-DEFINE:QUERYPARAM="token"
1080.m3u8{$token}

#EXT-X-STREAM-INF:BANDWIDTH=16000000,RESOLUTION=3840x2160
#EXT-X-DEFINE:QUERYPARAM="token"
2160.m3u8{$token}

The requesting URL is https://example.com/stream.m3u8!<hash>?token=<hash> and I am using an iPhone 15 running iOS 17.1.

The QUERYPARAM substitution as described here is not working, because the requested URL for 540.m3u8 does not have a token appended it; I know this because I checked my apache error log.

The file is hosted on a Debian 11 server.

Have I implemented this correctly, and do I have the correct tech stack? Furthermore, what debugging tools should I be running to investigate further?

This is not correct.

Section 4.4.2.3 - "An EXT-X-DEFINE tag MUST NOT specify the same Variable Name as any other EXT-X-DEFINE tag in the same Playlist." Which is to say, you must have exactly one occurrence of #EXT-X-DEFINE:QUERYPARAM="token"

I would have expected this playlist to not play at all.

EXT-X-DEFINE: how to implement QUERYPARAM on iOS 16.5+
 
 
Q