现在我已经用firebase开发了云功能,部署后我得到了类似这样的端点
https://us-central1-app-id.cloudfunctions.net/api/path/of/api/
我的问题是,是否可以使用 nginx 代理将自定义域映射到此端点
http://my-domain.com/path/of/api/
经过一些实验后,将我的自定义域链接到云功能后,我得到了这个错误
404. That’s an error.
The requested URL /path/of/api/ was not found on this server. That’s all we know.
这是我在 nginx 上的配置
location /path/of/api/ {
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Connection "Keep-Alive";
proxy_set_header Proxy-Connection "Keep-Alive";
proxy_cache_bypass $http_upgrade;
proxy_pass https://us-central1-app-id.cloudfunctions.net/api;
}