Dynamic secured proxy

I need a method of allowing an authenticated user to establish a proxied
web session to a device via my rails app. The user will not be able to
directly connect to the device due to subnets/firewalls, so all requests
need to be sent via the public web server.

I looked into just using apache’s mod_proxy, but this requires
statically configuring all proxy entries in httpd.conf, and then those
entries are always there. I need a way for a user to select a device
via my web app, and then if they have the proper security access, open a
web session to that device.

Does anyone know of a good way to accomplish this? Any pre-made gems
out there do this?

Any help would be much appreciated.