Skip to content

Instantly share code, notes, and snippets.

@leandromoreira
Created April 19, 2020 16:35
Show Gist options
  • Save leandromoreira/d346548709c1f8d917597ab47912a510 to your computer and use it in GitHub Desktop.
Save leandromoreira/d346548709c1f8d917597ab47912a510 to your computer and use it in GitHub Desktop.
git checkout 1.0.4
# in tab1 - run the NOTT
make run
# in tab2 - run the tv show
make broadcast_tvshow
# in tab3 - test
http http://localhost:8080/hls/colorbar.m3u8
# in tab4 - let's add the token CU
# to act in access rewrite phase
# -- first need to discovery the redis cluster id
docker ps | grep redis
# -- then let's connect to the redis cluster
docker exec -it f44ed71b3056 redis-cli -c -p 7000
# inside redis-cluster let's add the CU
set authentication "rewrite||local token = ngx.var.arg_token or ngx.var.cookie_superstition \n if token ~= 'token' then \n return ngx.exit(ngx.HTTP_FORBIDDEN) \n else \n ngx.header['Set-Cookie'] = {'superstition=token'} \n end"
sadd coding_units authentication
# go back to tab3 - you should eventually (after max 20s)
# receive 403 as response
http http://localhost:8080/hls/colorbar.m3u8
# then add the token and it'll work again
http http://localhost:8080/hls/colorbar.m3u8?token=token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment