Specify instance-id in fly-replay header

Attempting to answer my own question here: The first 4 bytes (d8899331) from FLY_ALLOC_ID is allegedly instance-id too.

➜  flyctl status --all -a <appname>                                                                           
App
  Name     = <appname>          
  Owner    = <owner>           
  Version  = <1>               
  Status   = running           
  Hostname = <appname>.fly.dev  

Instances
ID      	PROCESS	VERSION	REGION	DESIRED	STATUS 
d8899331	app    	<1>    	<r>   	run    	running

-

➜  flyctl ssh console -a <appname>
Connecting to top1.nearest.of.<appname>.internal... complete
# echo $FLY_ALLOC_ID
d8899331-7771-8881-9991-111111111112
note-to-self:

Instead of fly-replay: instance=d8899331, the client can fly-force-instance-id http-header (works only if Fly http handler is able to see and act on the incoming http-header): Is it possibly for a client to connect to a particular instance - #4 by jerome

Otherwise, forwarding requests over Fly’s 6pn (“internal services” listening on fly-local-6pn or :: or _local_ip.internal Private networking not working - #4 by kurt) to the primary instance at <fly-alloc-id>.vm.appname.internal should work just as well: Send request to a specific VM - #2 by greg

4 Likes