0

I have the following (python3.7) Cloud Function written that return "Hello":

https://us-central1-first-outlet-750.cloudfunctions.net/test

I would like to route a domain to this IP. So that someone can use our company URL instead of having to remember the long Google URL to enter in. For example, the a user to be able to enter in:

https://mycompany.com/test

And it to route to the Google URL. What would be the cleanest way to achieve this? For example, some options are:

  • Set up some flask server and redirect to the GCF url (though sort of defeats the purpose of "auto-scale" as all the IP requests have to route through our own apache server.
  • Set up some kind of API Gateway so that it routes traffic to that. Is it possible to do this in GCP? If so, how can I do that?

Here's a similar question, but is more in line with function egress rather than what I'm looking to do: Possible to get static IP address for Google Cloud Functions?

David542
  • 104,438
  • 178
  • 489
  • 842
  • 1
    There are three Google Cloud products: Firebase (very easy), Cloud Endpoints, and Apigee (great product) that interface with Cloud Functions. None of them support IP only based addressing. The HTTP Host header is used to provide "finding" the service. Please review Doug's answer on using Firebase. This is simple, clean and scalable with some requirements that you must meet. If you must have a public IP address, you will have to implement your own proxy that then calls Cloud Functions. – John Hanley Nov 22 '19 at 19:59

1 Answers1

2

You can do this with Firebase Hosting integration with Cloud Functions. You will have to connect your domain to Firebase Hosting, then set up a rewrite rule to proxy a URL pattern to your function.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • 1
    It would not involve writing any extra code. It's just configuration to proxy the URL pattern to a function. The function can be implemented any way you want, as long as it's deployed to us-central1. – Doug Stevenson Nov 22 '19 at 19:47