If you would like to upgrade to a newer long-term support version of Studio Pro, see Moving from Mendix Studio Pro 8 to 9.

Using a Proxy to Call a REST Service

Last modified: August 20, 2024

Introduction

In some cases, you will be stuck behind a firewall and thus unable to call a REST service directly. This page shows you how to configure your app to use a proxy to call such services.

Proxy Host and Proxy Port

There are two parameters that specify which proxy server to use when making REST calls: http.proxyHost and http.proxyPort. Some proxies require authentication, which you may specify as http.proxyUser and http.proxyPassword.

You can either specify these as custom settings or as JVM parameters, which are described in the sections below.

Custom Settings

REST proxy settings can be configured as custom settings on the Project > Settings > Configurations > Custom tab. For more information, see the Custom section of Configurations.

JVM Parameters

REST proxy settings can be configured in the Project > Settings > Configurations > Server tab > Extra JVM parameters field. For more information, see the Server section of Configurations.

They can also be specified as JVM parameters in your .m2eerc. This is useful if you want to use these settings to also consume web services.

...
# custom java options, like -Xmx256m or -Djava.foo=bar
 javaopts: [ ..., "-Dhttp.proxyHost=myproxyserver.com", "-Dhttp.proxyPort=3128", "-Dhttp.proxyUser=myusername" "-Dhttp.proxyPassword=mypassword" ]
...

They can also be specified directly when running locally from Studio Pro or calling from Eclipse:

-Dhttp.proxyHost=myproxyserver.com  -Dhttp.proxyPort=3128 -Dhttp.proxyUser=myusername -Dhttp.proxyPassword=mypassword