1
votes

In my Angular 5 application I am using an Express app in combination with Firebase Cloud functions to render dynamic HTML markup for improved SEO purposes. Specifically for search crawler bots.

This works for all my routes except at root level (https://exampleapp.firebaseapp.com/) which serves the normal index.html instead of the result of my firebase function.

My firebase.json file looks like this:

  {
        "hosting": {
          "public": "dist",
          "rewrites": [
            {
              "source": "**",
              "function": "app"
            }
          ]
        }
      }

So all requests should be served by my app function. But why is this not the case for my root domain? Is there an extra step to ensure that the root is also included in this use case?

Edit:

And just to clarify I need the index.html file available in my dist folder to serve my users but I'm serving all crawlers with my express app which currently is working on all routes except the root domain.

1

1 Answers

1
votes

Remove the index.html from the public folder and it should be served from the function.

https://youtu.be/LOeioOKUKI8?t=13m53s

This video has a nice tutorial and the time refers to your issue specifically I would say.