I currently have my Time Capsule to forward all inbound requests on port 80 to my Mac Mini which runs a web server with its local ip address of
192.168.1.8. I also have DNS set up so that if I go to
example.com then it will send the request to my static public IP which will in turn cause the Time Capsule to forward the request on port 80 to my Mac Mini.
However I now have a Raspberry Pi on the local network also, with the ip address of
192.168.1.5. I want to be able to access the web server on the Raspberry Pi by going to
pi.example.com, but I'm not sure how I can get the Time Capsule to port forward based on the domain. What I'd like to be able to have is something that works like this:
example.com:80 --> public IP --> 192.168.1.8:80 pi.example.com:80 --> public IP --> 192.168.1.5:80
NB: Posted this on apple.stackexchange.com as it relates to the Time Capsule, however it may be better suited on ServerFault, if so I ask if the moderators could kindly move it there.