Contact Free trial Login

Public Portal Vanity Domain

This document contains instructions and the necessary NGINX configuration for setting up an organization’s public portal using a vanity domain.

Whitelist Your Domain

Your domain needs to be whitelisted in Exchange for your public portal to work properly. To do so:

  1. Get an access token from an Anypoint Platform user account that has the Organization Administrator role in the master organization:

    ACCESS_TOKEN=$(curl https://anypoint.mulesoft.com/accounts/login -XPOST -d "username=YOUR_USERNAME&password=YOUR_PASSWORD" | jq -r ".access_token")
  2. Use the access token to whitelist your custom domain:

    curl https://anypoint.mulesoft.com/exchange/api/v1/organizations/YOUR_ORGANIZATION_DOMAIN/portal/domain -XPUT -d your.custom.domain -H "content-type: text/plain" -H "authorization: bearer $ACCESS_TOKEN"
    If this step is not followed, you won’t be able to log in to the portal or perform any actions that need authentication.

Set up a reverse proxy

A reverse proxy allows users to access and navigate the vanity domain site exactly as if they were at the MuleSoft site. For example, users could access and navigate https://developers.robocop.com/path/of/justice/ exactly as if they were at https://anypoint.mulesoft.com/exchange/portals/robo-cop/.

This can be achieved through a reverse proxy that reroutes requests to your specific domain to the Anypoint Platform. In the following section, we provide example minimal NGINX configuration rules needed to implement the reverse proxy correctly.

You can set up the reverse proxy on servers other than NGINX, including Apache, content delivery networks (CDNs), and many more. The specific configuration needed for your current web server implementation may need to vary slightly, but the rules should be implemented in the same way.

Generic configuration

To set up a basic reverse proxy for a portal vanity domain configuration, set up route mapping and custom headers.

Route mapping

Set up static resource route mapping for shared, icons, exchange/api-console, and node_modules. Regardless of your portal path, these routes need to be at the root level.

For example:

  • Route https://developers.robocop.com/shared to https://anypoint.mulesoft.com/shared.

  • Route https://developers.robocop.com/icons to https://anypoint.mulesoft.com/icons.

  • Route https://developers.robocop.com/node_modules to https://anypoint.mulesoft.com/node_modules.

  • Route https://developers.robocop.com/exchange/api-console to https://anypoint.mulesoft.com/exchange/api-console.

Route callback to https://anypoint.mulesoft.com/exchange/portals/YOUR_ORGANIZATION_DOMAIN/callback.

For example:

  • Route https://developers.robocop.com/callback to https://anypoint.mulesoft.com/exchange/portals/robo-cop/callback.

Route all your portal traffic to the Anypoint Platform. This depends on the portal path. Your portal path may be any path. The example’s portal path is path/of/justice/.

For example:

  • Route https://developers.robocop.com/path/of/justice/ (and all routes under this path) to /https://anypoint.mulesoft.com/exchange/portals/robo-cop/.

Custom headers

Add headers for each route described above.

'X-Forwarded-Path': Base path of your vanity domain public portal URL. This can be any path. It can be just '/' for the root path. It does not need to match the base path for the portal in the anypoint.mulesoft.com domain. This path must end with a slash ("/"). Example: 'path/of/justice/'
'X-Forwarded-Host': Your public portal vanity domain. Example: 'developers.robocop.com'

Using NGINX

location ~ /(shared|node_modules|icons|exchange/api-console) {
    proxy_set_header X-Forwarded-Host $http_host;
    proxy_set_header X-Forwarded-Path ${PUBLIC_PORTAL_PATH};

    proxy_pass ${ANYPOINT_BASE_URL};
}

location /callback {
    proxy_set_header X-Forwarded-Host $http_host;
    proxy_set_header X-Forwarded-Path ${PUBLIC_PORTAL_PATH};

    proxy_pass ${ANYPOINT_BASE_URL}/exchange/portals/${ORGANIZATION_DOMAIN}/callback;
}

location ${PUBLIC_PORTAL_PATH} {
    proxy_set_header X-Forwarded-Host $http_host;
    proxy_set_header X-Forwarded-Path ${PUBLIC_PORTAL_PATH};

    proxy_pass ${ANYPOINT_BASE_URL}/exchange/portals/${ORGANIZATION_DOMAIN}/;
}

With:

${PUBLIC_PORTAL_PATH}: Your custom path. Must end with a forward slash "/".
${ANYPOINT_BASE_URL}: Anypoint Platform URL for the desired region.
${ORGANIZATION_DOMAIN}: Your organization's domain in Anypoint Platform.

For example, for the Robocop organization public portal with an Anypoint Platform domain of robo-cop to run on developers.robocop.com/path/of/justice/:

${PUBLIC_PORTAL_PATH}: /path/of/justice/
${ANYPOINT_BASE_URL}: https://anypoint.mulesoft.com
${ORGANIZATION_DOMAIN}: robo-cop
Your server must run using https.

If set up correctly, you can access and navigate to https://developers.robocop.com/path/of/justice/ exactly as if you were at https://anypoint.mulesoft.com/exchange/portals/robo-cop/.

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.