Skip to content

d-sushko/firebase-functions-proxy-server

 
 

Repository files navigation

Deploy

Deploy to Heroku

Deploy to DO

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',
  },
},

About

Firebase functions proxy server (with logging)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%