Define http header of remote library

Hi,

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?

Regards,
Markus

Hey Markus,

I don’t think that this is possible.

Remote just takes the url of the lib and hands it over to xmlrpclib.

Do You really need Remote?
Or are you “just” interested to execute some keywords on the other side?

I once implemented something with flask-api.

This is a nice and super easy to implement http server where can send GET or POST requests.

You could use python requests to authenticate on you proxy and trigger the keyword.

Hi René,

I intend to run a library as service. My infrastructure requires a gateway between a service and the client.

It looks to me, Xmlrpcclient basically provides such a feature:

You think it may be possible, if I would implement the server proxy in to RF?

Greetings,
Markus

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.