p_escobr
p_escobr

Reputation: 41

How to enable localization for Angular 18 SSR on Firebase App Hosting?

I’m hosting an Angular 18 SSR project on Firebase's new App Hosting service. I need to set up localization (e.g., /en, /tr paths). Do I need to configure nginx for this, or does Firebase App Hosting natively support routing and language-based configurations? I didnt find any explanation on documentation due to it is a little bit new service.

I tried the way that is documentation mentions. I faced problem on baseHref. I defined baseHref for all defined locales but no way routing is not working. Then I realized that Angular doc. says "use nginx or apache" for this. I m confused a little bit. Does Firebase App Hosting have a built-in solution for this process?
Thank you.

Upvotes: 0

Views: 78

Answers (1)

helios
helios

Reputation: 369

You can define rewrites in firebase.json:

{
  "hosting": {
    "source": ".",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "en/{,/**}",
        "destination": "en/index.html"
      },
      {
        "source": "de/{,/**}",
        "destination": "de/index.html"
      },
      {
        "source": "fr/{,/**}",
        "destination": "fr/index.html"
      }
    ]
  }
}

Upvotes: 0

Related Questions