Setup Proxy Local

John Hill edited this page Mar 10, 2016 · 1 revision

Setup Proxy-Local

This is an example of setting up the file-proxy to serve files from a locally mounted drive.


The following Java properties must be provided to the file-proxy server (-Dkey=value):

Property Name Description
org.sagebionetworks.url.signer.secret.key The credentials used to sign pre-signed URLs. The credentials should match the value of the 'ProxyStorageLocationSettings.secretKey' set in Synapse.
org.sagebionetworks.local.path.prefix Required to server files locally. Callers will request files by providing a relative path. An additional path prefix is needed to resolve these relative paths to actual files. This configuration provides this path prefix.

Proxy Server

In this example proxy server will be launched locally. The proxy server must be configured with the secret key used to sign URLs generated from Synapse and the path prefix.

git clone
cd file-proxy

The proxy server can then be started by passing all of the relevant configuration information as system properties (-Dkey=value) as follows

mvn tomcat:run -D"org.sagebionetworks.url.signer.secret.key=<url_signer_key>" -D"org.sagebionetworks.local.path.prefix=C:/Users/John/Downloads"

console output:

[INFO] --- tomcat-maven-plugin:1.1:run (default-cli) @ file-proxy ---
[INFO] Running war on http://localhost:8080/file-proxy
[INFO] Using existing Tomcat server configuration at C:\cygwin64\home\jhill\git\file-proxy\target\tomcat
Feb 08, 2016 4:16:18 PM org.apache.catalina.startup.Embedded start
INFO: Starting tomcat server
Feb 08, 2016 4:16:19 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.29
Feb 08, 2016 4:16:19 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Feb 08, 2016 4:16:19 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080

The console shows the proxy server running at URL as http://localhost:8080/file-proxy


Before we can start creating ProxyFileHandles for the above setups we must first register a new StorageLocation with Synapse. The ProxyStorageLocationSettings contains all of the parameters Synapse will need to generated ProxyFileHandles and to issue pre-signed URL for ProxyFileHandles. The following curl call was used to create the ProxyStorageLocationSettings:

curl -k -H "sessionToken:<session_token>" -H "Content-Type: application/json" -X POST -d '{"uploadType":"PROXYLOCAL","secretKey":"<url_signer_key>", "proxyUrl":"https://localhost:8080/file-proxy", "concreteType":"org.sagebionetworks.repo.model.project.ProxyStorageLocationSettings"}'




Once the proxy servers started and the ProxyStorageLocationSettings is created in Synapse, we can start creating ProxyFileHandles for each file.

curl -k -H "sessionToken:<session_token>" -H "Content-Type: application/json" -X POST -d '{"storageLocationId":"4171", "filePath":"/public/downloads/Before.png", "fileName":"Before.png", "contentType":"image/png", "contentMd5":"md5", "contentSize":"29486", "concreteType":"org.sagebionetworks.repo.model.file.ProxyFileHandle"}'



File download

The final step is to test downloading the file through the proxy by fetching a pre-signed URL for the ProxyFileHandle from Synapse:

curl -k -H "sessionToken:<session_token>" ""


You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.