Reactjs 脚本资源位于不允许的重定向后面。firebase云消息传递firebase-messaing-sw.js

Reactjs 脚本资源位于不允许的重定向后面。firebase云消息传递firebase-messaing-sw.js,reactjs,firebase,firebase-cloud-messaging,Reactjs,Firebase,Firebase Cloud Messaging,这实际上是本主题的重复,因为没有人对此作出答复: 您好,从过去一个月起,我们的firebase应用程序开始出现此错误。“脚本资源在重定向后面,这是不允许的。”我们已经在服务器的根目录下注册了firebase-messaging-sw.js,它也会在浏览器中打开。同样的代码在localhost中非常有效,但在公共域(cloudflare dNS)中会出现此错误 已经尝试过此处提到的解决方案: 我们的现行守则: messaging = firebase.messag

这实际上是本主题的重复,因为没有人对此作出答复:

您好,从过去一个月起,我们的firebase应用程序开始出现此错误。“脚本资源在重定向后面,这是不允许的。”我们已经在服务器的根目录下注册了firebase-messaging-sw.js,它也会在浏览器中打开。同样的代码在localhost中非常有效,但在公共域(cloudflare dNS)中会出现此错误

已经尝试过此处提到的解决方案:

我们的现行守则:

                messaging = firebase.messaging();
                $this.setState({messaging});
                messaging.useServiceWorker(registration);
                messaging.requestPermission().then(function() {

                    $this.setState({permission:true});
                    messaging.getToken().then(function(currentToken) {
                        $this.setState({fcmtoken:currentToken});

                        resolve(currentToken);
                    });
                });
            });

firebase-messaging-sw.js内容:

```    importScripts("https://www.gstatic.com/firebasejs/5.3.0/firebase-messaging.js");
     var config = {
      apiKey: "AIzxxxxxxxxxxxxxx0",
      authDomain: "noxxxxions-7xxxd.firebaseapp.com",
      databaseURL: "https://notifications-76xxxxd.firebaseio.com",
      projectId: "nxxxxxxxxxxd",
      storageBucket: "notifixxxxxx.appspot.com",
      messagingSenderId: "90000000000"
    };
    firebase.initializeApp(config);
    var messaging = firebase.messaging();


    messaging.setBackgroundMessageHandler(function(payload) {

      var notificationTitle = "Background Message Title";
      var notificationOptions = {
        body: "Background Message body.",
        icon: "/firebase-logo.png"
      };

      return self.registration.showNotification(notificationTitle,
        notificationOptions);
    });```

“是”的可能重复项是相同的,因为没有人对此进行答复:。我创建了一个新主题。有解决方案吗?可能是重复的,因为没有人对此进行回复:。我创建了一个新主题。有什么解决方案吗?