Entering to my app hosted on firebase hosting redirects to google login page

半城伤御伤魂 提交于 2020-01-14 10:45:08

问题


Was tweaking with Server Side Rendering and google cloud functions. Deployed everything on hosting and something really strange happens. When I enter my page, https://accounts.google.com page appears...

with some really long link:

https://accounts.google.com/signin/v2/identifier?
 service=ah&passive=true&continue=https%3A%2F%2Fappengine.google.com
  %2F_ah%2Fconflogin%3Fcontinue%3Dhttps%3A%2F%2Fus-central1-treebase-
   b21-d5.cloudfunctions.net%2Fssrapp%2F&flowName=GlifWebSignIn&flowEntry=
    ServiceLogin&hl=en-GB

What may cause this? How to fix it? Thanks!

index.js file responsible for SSR:

import React from 'react';
import { renderToString } from 'react-dom/server';
import express from 'express';
import App from './app/containers/App';
import functions from 'firebase-functions';

const app = express();

app.get('**', (req, res) => {
  const html = renderToString(<App />);
  res.set('Cache-Control', 'public, max-age=600, s-maxage=1200');
  res.send(`
    <!doctype html>
    <html lang="en">
      <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
      </head>

      <body>
        <div id="app">${html}</div>
        <div id="fb-root"></div>
        <script type="text/javascript" src="/main.30e39d69fe1ce70d8983.js"></script>
      </body>
    </html>
  `);
});

export const ssrapp = functions.https.onRequest(app);

firebase.json

{
  "hosting": {
    "public": "build",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "function": "ssrapp"
      }
    ]
  }
}

回答1:


If you are using HTTP functions to serve dynamic content for hosting, you must use us-central1



来源:https://stackoverflow.com/questions/48874671/entering-to-my-app-hosted-on-firebase-hosting-redirects-to-google-login-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!