Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adinvadim/firebase-functions-proxy-server
Firebase functions proxy server
https://github.com/adinvadim/firebase-functions-proxy-server
Last synced: about 2 months ago
JSON representation
Firebase functions proxy server
- Host: GitHub
- URL: https://github.com/adinvadim/firebase-functions-proxy-server
- Owner: adinvadim
- Created: 2022-04-16T13:26:20.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-04-18T11:44:28.000Z (over 2 years ago)
- Last Synced: 2023-02-27T10:18:32.066Z (almost 2 years ago)
- Language: JavaScript
- Size: 46.9 KB
- Stars: 1
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Deploy
[![Deploy to Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/adinvadim/firebase-functions-proxy-server)
[![Deploy to DO](https://www.deploytodo.com/do-btn-blue.svg)](https://cloud.digitalocean.com/apps/new?repo=https://github.com/adinvadim/firebase-functions-proxy-server/tree/master)
# How it work
## Proxy functions
It is simple proxy server.
`/functions/:region/:projectId/example-function-name` -> `https://${region}-${projectId}.cloudfunctions.net/example-function-name`
Example:
`europe-west1` and `example`
`/functions/europe-west1/example/example-function-name` -> `https://europe-west-1-example.cloudfunctions.net/example-function-name`
Also support query and many levels in paths (`/example-function-name/sub-path/another-path`)
## Proxy firestore
Connect domain to your proxy server and set domain in firestore settings.
Example with proxy server on domain `your-domain.com`:
```
const db = firebase.firestore();
db.settings({
host: 'your-domain.com/firestore',
ssl: true
})
```## Proxy auth
You need replace `www.googleapis.com` and `securetoken.googleapis.com` with
proxy urls.One of possible for it is webpack plugins.
Example with proxy server on domain `your-domain.com`:
```
{
enforce: 'pre',
test: /\.js$/,
loader: 'string-replace-loader',
options: {
search: 'www.googleapis.com',
replace: 'your-domain.com/auth',
flags: 'g',
},
},
{
enforce: 'pre',
test: /\.js$/,
loader: 'string-replace-loader',
options: {
search: 'securetoken.googleapis.com',
replace: 'your-domain.com/securetoken',
flags: 'g',
},
},
```