1. A method executed by a processor in a server of a private network for dynamically setting up a session between a target resource in the private network and an application on a device, wherein the device belongs to the private network, the method comprises: receiving, by the server, from the application a request to get the target resource in the private network, checking, by the server, if a user of the device is authorized to access the server, identifying, by the server, a session anchor, instantiating, by the server, a proxy agent within the private network with address information of the identified session anchor such that the proxy agent can establish a connection to the session anchor identified by said address information, receiving, by the server, a session Universal Resource Locator, URL, in response to said instantiating and performing a mapping between a URL of the target resource and a session URL issued by said session anchor, and determining, by the server, whether the device and the target resource are on the same private network, such that the application can access the target resource directly if they are on the same private network, or such that the application can access the target resource via the session anchor by using the session URL if they are not on the same private network.