在使用 HTTPS 的 Parse-Dashboard 中遇到“服务器无法访问:未经授权”错误

问题描述 投票:0回答:1

我已经按照安装指南中描述的步骤在运行 Ubuntu 的服务器上成功安装了解析服务器。

我的服务器很好,可以在

https://www.example.com/parse
中使用此配置:

解析服务器配置

{
  "appId": "app",
  "clientKey": "client",
  "masterKey": "master",
  "appName": "MyParseApp",
  "cloud": "./cloud/main",
  "serverURL": "https://www.example.com/parse",
  "masterKeyIps": [my_ips],
  "databaseURI": "postgres://postgres:password@localhost:5432/postgres"
}

example.com 的 Apache VirtualHost 配置

<VirtualHost *:80>
    DocumentRoot /var/www/html/example.com

    ServerName example.com
    ServerAdmin [email protected]

    ErrorLog /var/log/apache2/example.com/http_error.log
    CustomLog /var/log/apache2/example.com/http_access.log combined
</VirtualHost>
<VirtualHost *:443>
        DocumentRoot /var/www/html/example.com

        ServerName example.com
        ServerAdmin [email protected]
    ServerAlias example.com

        ErrorLog /var/log/apache2/example.com/https_error.log
        CustomLog /var/log/apache2/example.com/https_access.log combined

    SSLEngine on
    SSLCertificateFile /etc/certificate/example.com.cer
    SSLCertificateKeyFile /etc/certificate/example.com.key
    
    SSLProxyEngine On
    ProxyRequests Off
    ProxyPass /parse http://localhost:1337/parse
    ProxyPassReverse /parse http://localhost:1337/parse
    ProxyPass /dashboard http://localhost:4040/dashboard
    ProxyPassReverse /dashboard http://localhost:4040/dashboard

    ProxyPreserveHost On
</VirtualHost>

然后我用这个命令启动仪表板:

nohup parse-dashboard --dev --config parse-dashboard-config.json &

相关配置

{
  "apps": [
    {
      "appId": "app",
      "masterKey": "master",
      "appName": "MyParseApp",
      "iconName": "",
      "primaryBackgroundColor": "",
      "secondaryBackgroundColor": "",
      "serverURL": "https://www.example.com/parse"
    }
  ],
  "users": [
    {
        "user": "username",
        "pass": "password"
    }
  ],
  "iconsFolder": "icons"
}

我故意设置了简单的

appID
/
masterKey
/
clientKey
值,以确保这里没有错误,比如打字错误。

我也可以按预期访问仪表板,但是当我在仪表板配置中将 serverURL 设置为

https://www.example.com/parse
时,我收到此错误:

但是,如果我为此 serverURL 值设置

http://www.example.com:1337/parse
,我可以访问仪表板并按预期查询/更新数据。

我已经尝试过在我在这里和 Parse-Server github repo 上遇到的不同主题中推荐的几件事,比如添加一个

allowInsecureHTTP
标志为真,但没有成功。

你能给我一些帮助吗?

非常感谢

parse-server
1个回答
0
投票

parse-server
版本需要
masterKeyIps
https://github.com/parse-community/parse-server/issues/8421

添加

masterKeyIps: ['0.0.0.0/0']
修复它。

© www.soinside.com 2019 - 2024. All rights reserved.