This is my NGINX config while testing GCF. I used OpenResty (NGINX) with some Lua code to make a dynamic upstream api gateway: https://github.com/ernestofreyreg/dynamic-upstream-nginx
Clone it and…
$ export HOSTIP=<your local IP> // This is only to map to local endpoings$ ./start.sh // Starts a NGINX and Redis containers
$ redis-cli
127.0.0.1:6379> set "route:<domain>:/" "https://us-central1-<project>-<###>.cloudfunctions.net/your-app-1_0_0"
And you can open that domain and see the redirect taking place.
This is working for me using GCF and nextjs. But now I am more interested in using Kong (https://getkong.org)