I would like to create a remote library that must be accessed through a gateway. The gateway checks for a specific token in the HTTP header in order to identify the actual remote server to forward the request to.
Can I run a remote server behind such a gateway and define in robot test case the HTTP header used when accessing remote library?
It’s probably doable, but not with the (python) remote library interface out of the box. Likely same with the other remote library server implementations. But if you modify/extend the code, of the server implementation, then yes.
If you change how RF initializes the remote library with specifying the header, that might alter/break the original interface specification/protocol of the remote library though. So you’d want to think through how to provide that to the remote server if not setting during remote server startup or statically coded, etc.
Just FYI: support for headers for remote connections in xmlrpc python library (which remote library in RF is based on) is only available in python 3.8 and onwards.
As possible workaround, having mitm proxy in between RF (client running the tests) and remote library, that would inject required headers would be an option. This would be the sort of what you described, a gateway … So, imho, it should be possible to do something you described.