Greetings,
I have a task to provide reliable solution to redirect external IP to domain.
Currently I have a VM with nginx doing:
#redirect to www
server {
listen [::]:80 reuseport default_server;
listen 0.0.0.0:80 reuseport default_server;
return 301 https://www.$host$request_uri;
}
Is there any way to do it serverless? Like external IP + global load balancer config? If so: how?
For URL map to handle the request you can try this:
"defaultRouteAction": {
"redirectAction": {
"httpsRedirectAction": true,
"prefixRedirect": "https://www.example.com",
"stripQuery": false,
"stripFragment": false
}
}
You can use this link[1] as a guidance for load balancer serverless backend. After the load balancer and URL map, make sure to configure or update your DNS record. From the code I shared, replace www.example.com using your own domain name.
[1]https://cloud.google.com/load-balancing/docs/https/setting-up-https-serverless