# Google CDN Configuration Guide

### Prerequisites:  <a href="#prerequisites" id="prerequisites"></a>

To be able to configure the reverse proxy on a Load Balancer in Google Cloud you should be either a project [owner or editor](https://cloud.google.com/iam/docs/understanding-roles#basic), or you should have the following roles: `roles/compute.networkAdmin` and `roles/compute.instanceAdmin`

***

## Implementation steps

### Step 1 Create the NEG and internet endpoint: <a href="#step-1-create-the-neg-and-internet-endpoint" id="step-1-create-the-neg-and-internet-endpoint"></a>

1. In the Google Cloud console, go to the **Network endpoint groups** page.

   [Go to Network endpoint groups](https://console.cloud.google.com/compute/networkendpointgroups/list)
2. Click **Create network endpoint group**.
3. Enter the name of the network endpoint group: `jentis-fqdn-neg`.
4. For **Network endpoint group type**, select **Internet NEG**.
5. For **Default port**, enter `443`.
6. For **New network endpoint**, select **Fully qualified domain name and port**.
7. For the FQDN, enter: hash of the JENTIS container as subdomain + . + website domain, e.g. [hash.yourwebsitedomain.com](http://hash.yourwebsitedomain.com/).
8. For **Port type**, select **Default**, and verify that **Port number** is `443`.
9. Click **Create**.\
   ![](https://2315305008-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy15ncufYr341K5U8q6Of%2Fuploads%2F7I9qxLKjxGhEZ2xgyAk2%2Fimage.png?alt=media\&token=5a971b73-6a45-401e-872c-f017350ebee8)

***

### Step 2: Create the backend service and add the internet NEG <a href="#step-2-create-the-backend-service-and-add-the-internet-neg" id="step-2-create-the-backend-service-and-add-the-internet-neg"></a>

1. In the Google Cloud console, go to the **Load balancing** page.

   [Go to Load balancing](https://console.cloud.google.com/networking/loadbalancing/list)
2. Select the classic Application Load Balancer of your website, and then select **Edit**.
3. Click **Backend configuration**.
4. In the **Backend services & backend buckets** menu, select **Create a backend service**.
5. Set the name of the backend service to `jentis`.
6. For **Backend type**, select **Internet network endpoint group**.
7. Select the protocol **HTTPS**.
8. Under **New backend > Internet network endpoint group**, select `jentis-fqdn-neg`, and then click **Done**.
9. Select **Disable Cloud CDN**.
10. In **Advanced configurations**, under **Custom request headers**, click **Add header**.
    1. For **Header name**, enter `Host`.
    2. For **Header value**, enter `hash.yourwebsitedomain.com`.
11. Click **Create**.\
    ![](https://2315305008-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy15ncufYr341K5U8q6Of%2Fuploads%2FIML4VBHd17LjIVUufaM4%2Fimage.png?alt=media\&token=3f4f0896-5b5e-4530-95a5-1fc73b265e83)
12. Attach the backend service to an existing URL map
    1. Click **Host and path rules**.
    2. The first row or rows have Google Cloud services in the right column, and one of them is already populated with the default rule `Any unmatched (default)` for **Hosts** and **Paths**.
    3. Ensure that there is a row with `jentis` selected in the right column. If it doesn't exist, click **Add host and path rule**, and select `jentis`. Populate the other fields as follows:
       1. In **Hosts**, enter `*`.
       2. In **Paths**, enter '/' and the hash of the container: `/hash`.\
          ![](https://2315305008-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy15ncufYr341K5U8q6Of%2Fuploads%2FRHRllsUaNMB6Z22FOvFU%2Fimage.png?alt=media\&token=d49512d4-d9ff-4aec-8054-ad7ac143fc36)

          &#x20;
    4. Click **Update**

{% hint style="danger" %}
After enabling Cookie lifetime extender, the DCP will give a proxy code that is expected to be setup on `https://domain.*/hash` however, if it is set up on `https://www.domain.*/hash` it will cause a CORS Error on the Cookie Lifetime Extender Requests.

For more details on WWW configuration follow this [guide](https://docs.jentis.com/key-features/cookie-lifetime-extender/configure-your-tracking#www-configuration-guide-optional).
{% endhint %}
