You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -287,3 +287,12 @@ To request data from a service the `iFC` inter-function communicator can be used
287
287
It is simply a http client wrapped in a function that will automatically find and make a call to a service given standard http parameters.
288
288
289
289
Additional documentation can be found in `iFC.js`
290
+
291
+
## Custom domains
292
+
293
+
Firebase supports custom domains for functions via firebase hosting. The official firebase docs are available here: <https://firebase.google.com/docs/hosting/functions>.
294
+
There is a bug (maybe?) in the firebase runtime that effects functions using a custom domain.
295
+
This framework uses an express router under the hood for all http functions. When a request comes in through the default firebase url to the `/` path of a service with a `basePath` of `users` the request path is `/`. This matches the configured route. When the same function is reached via a firebase hosting rule that directs `<your-domain>/users` to the `users` function the request path is `/users`.
296
+
We cannot check the domain of the request because the request domain is the same whether the requests originates from a custom domain or the default one. In order to provide support for both use-cases we have to mount the service's express.js router to 2 paths:`/` and `/<service-basePath>`, inthis case `/` and `/users`.
297
+
For many projects this will present no issue but in the case of a route that looks like this`/users/users` the behavior may be unpredictable.
298
+
Hopefully in the future this issue will be fixed in the firebase runtime by the firebase team. Until then we must live with the constraints that this provides.
0 commit comments