simokhalil
simokhalil

Reputation: 183

Firebase hosting rewrite for external wordpress under /blog path

I'm working on a React app hosted on Firebase, and a Wordpress blog hosted on Godaddy.

Is it possible to have the Wordpress blog rendering under /blog ?

I tried something like this in firebase.json (handeling multiple targets):

 "hosting": [
    {
      "target": "site1",
      "public": "site1/public",
      "rewrites": [
        {
          "source": "/blog/**",
          "destination": "myblog.example.com"
        }
      ]
    },
    ...
 ]

But I'm getting the 404 page from the React app.

I know I can rewrite to a Cloud Function, but how to "proxy" to the external blog, preventing the app to "catch" the request ?

Upvotes: 0

Views: 449

Answers (1)

Michael Bleigh
Michael Bleigh

Reputation: 26333

You can't rewrite to arbitrary URLs -- to accomplish this you'd need to deploy a Cloud Function that proxied to the Wordpress blog using e.g. node-http-proxy. You could also use Cloud Run to host the Wordpress blog directly and rewrite to the Cloud Run service.

Upvotes: 1

Related Questions