Skip to main content

How to Set Up a Reverse Proxy to PartnerPage with Amazon CloudFront

Using CloudFront's CDN, you can customize your directory URL to seem as if it's part of your site, such as yourdomain.com/partners

Written by Ali Winberry
  1. After logging into CloudFront, click on 'Distributions.' Then click 'Create distribution.'

2. In the origin domain field, enter in your PartnerPage URL for your directory. Copy it from PartnerPage: in your directory, go to Customizations > URLs, click Reverse proxy, and copy the address under 2. Locate your CDN configuration guide. Enter it without https://. It has the format <directory ID>.directory.sites.partnerpage.io. Make the following changes for the origin configurationClick on HTTPS only. Then hit create distribution at the bottom.

In the Cache key and origin request section, create a new cache policy. Under Origin Request Headers select Add header and add the two following headers:

  1. Header Name: PartnerPage-Client-IP, Value: clientIP

  2. Header Name: PartnerPage-Reverse-Proxy, Value: true (type the word true without quotes)

In the same cache policy, set Query strings to All, so CloudFront forwards the full path and query string of every request. Don't add the Host header to the policy: CloudFront then sends your PartnerPage address as the host, which PartnerPage needs. All other settings can remain as-is.

3. In the example below, your domain will be shown in the Domain name field. This example generated a default domain name to use. Click on the ID number to see additional details.

4. When you open the details of the distribution, you will see your domain under the Distribution domain name. This means that the distribution is done, and ready to go! Your domain will be displayed here instead of this default domain in the example.

5. Next, enter your domain and path in PartnerPage. In your directory, go to Customizations > URLs and click Reverse proxy under 1. Choose your setup method. Under 5. Set your custom URL, enter the domain and path CloudFront serves, such as yourdomain.com/partners, without https://. Then click Save.

6. Open yourdomain.com/partners in your browser to check that your directory loads. If you see "Invalid reverse proxy setup", check the headers in step 2 and the address in step 5. More help: Use your own domain for your directory.

Additional configuration examples

Origin settings

Pattern matching behavior settings - Precedence 0

Default behavior settings - Precedence 1

Did this answer your question?