Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Unable to access the paths on the path matcher of the url map

I created an HTTPS load balancer with the following URL map:

host_path_rules.png

 

I created an SSL certificate for my domain and connected it to the target proxy of the load balancer:

When i go to <domainname.com>, i get the expected output from the bs-video-site backend service.

However, when i go to <domainname.com/video/hd> or <domainname.com/video/sd>, i get the following error:

Not Found

The requested URL was not found on this server.


Apache/2.4.62 (Debian) Server at thestranger.cloud Port 80

====================

I have checked all my backends, and they are in an healthy state.

For the `/video/hd` path i created an instance template using the following script. the instance group points to this instance template:

 

gcloud compute instance-templates create TEMPLATE_NAME \
  --region=REGION \
  --network=NETWORK \
  --subnet=SUBNET \
  --stack-type=IPV4_ONLY \
  --tags=allow-health-check \
  --image-family=debian-10 \
  --image-project=debian-cloud \
  --metadata=startup-script='#! /bin/bash
    apt-get update
    apt-get install apache2 -y
    a2ensite default-ssl
    a2enmod ssl
    vm_hostname="$(curl -H "Metadata-Flavor:Google" \
    http://metadata.google.internal/computeMetadata/v1/instance/name)"
    echo "VIDEO-HD" | \
    tee /var/www/html/video/hd/index.html
    systemctl restart apache2'

 

When i SSH into my VM instance created using the instance group (based off the above template), i don't see the `/var/www/html/video/hd/index.html` path. I only see `/var/www/html/index/html`

So what am i missing here please?

Solved Solved
0 3 273
1 ACCEPTED SOLUTION

I have been able to access the paths.

I had to update the path in my apache server from `/var/www/html/index.html` to `/var/www/html/video/sd/index.html`.

#! /bin/bash
    apt-get update
    apt-get install apache2 -y
    a2ensite default-ssl
    a2enmod ssl
    sudo mkdir -p /var/www/html/video/sd
    echo "VIDEO-SD" | \
    tee /var/www/html/video/sd/index.html
    systemctl restart apache2

 

View solution in original post