Use custom domain for Google Cloud Function

I do not see anywhere the ability to configure my own domain for my Google Cloud function when using HTTP triggers. It seems like a pretty serious omission. Can I use my own domain instead of my own domain location-project.cloudfunctions.netor some workaround to the same effect?

I read an article suggesting using a CDN in front of a function with the URL of the function specified as the pull zone. This will work, but it will lead to unnecessary costs - and in my scenario, no content can be cached, so using CDN is far from ideal.

+22
source share
2 answers

, Proxy Nginx, Apache . 2 Firebase Load Balance HTTPS .

https://github.com/presslabs/gs-proxy/blob/master/nginx.conf

,

upstream gs {
    server storage.googleapis.com:443;
    keepalive 128;
}

server {

    ## YOUR CURRENT CONFIG ##

    location ~ /cdn/(.*)$ {

        proxy_set_header    Host storage.googleapis.com;
        proxy_pass          https://gs/BUCKETNAME/subpath/$1;
        proxy_http_version  1.1;
        proxy_set_header    Connection "";

        proxy_intercept_errors on;
        proxy_hide_header       alt-svc;
        proxy_hide_header       X-GUploader-UploadID;
        proxy_hide_header       alternate-protocol;
        proxy_hide_header       x-goog-hash;
        proxy_hide_header       x-goog-generation;
        proxy_hide_header       x-goog-metageneration;
        proxy_hide_header       x-goog-stored-content-encoding;
        proxy_hide_header       x-goog-stored-content-length;
        proxy_hide_header       x-goog-storage-class;
        proxy_hide_header       x-xss-protection;
        proxy_hide_header       accept-ranges;
        proxy_hide_header       Set-Cookie;
        proxy_ignore_headers    Set-Cookie;
    }

    # location / { ... #
}

Access-Control-Allow-Origin .

, , SEO, .

0

All Articles