我尝试将我的测试平台聊天机器人移至生产环境。在测试中,我使用了 HTTP 连接,现在我需要转移到 HTTPS。我获得了 HTTPS 连接,但不再获得聊天机器人窗口。
这是我的配置文件
首先是Apache2虚拟站点配置文件
Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
我的索引文件
{
$node = $dom->createElement($key);
if ($value != NULL)
{
foreach ($value as $key => $value)
{
$sub = $this->createNode($key, $value);
if ($sub != NULL)
{
$node->appendChild($sub);
}
}
}
}
Apache 端口
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
#<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName vetbot1.omnia.fi
#ServerName vetbot4.westeurope.cloudapp.azure.com
ServerAlias www.vetbot1.omnia.fi
DocumentRoot /var/www/html/vetbot
<Directory /var/www/html/vetbot>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</Directory>
### following three lines are for CORS support
#Header add Access-Control-Allow-Origin "*"
#Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
#Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"
ErrorLog /home/paulii/apache_ssl_debug.log
#ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLProxyEngine On
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/vetbot1.omnia.fi/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/vetbot1.omnia.fi/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
# Proxy HTTP requests
ProxyPass "/" "http://vetbot1.omnia.fi:5008/"
ProxyPassReverse "/" "http://vetbot1.omnia.fi:5008/"
#ProxyPass / http://20.71.134.48/
#ProxyPassReverse / http://20.71.134.48/
</VirtualHost>
</IfModule>
Rasa 聊天机器人在 Docker 容器中运行并暴露了端口 5008
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<script src="https://cdn.jsdelivr.net/npm/rasa-webchat@0.11.12/lib/index.min.js"></script>
<link rel="stylesheet" type="text/css" href="st.css">
</head>
<body>
<div id="webchat"></div>
<script>
WebChat.default.init({
selector: "#webchat",
initPayload: "/tervetuloa",
customData: {"language": "fi"}, // arbitrary custom data. Stay minimal as this will be added to the socket
socketUrl: "http://vetbot1.omnia.fi:5008",
socketPath: "/socket.io/",
embedded: false,
title: "Webottinen",
subtitle: "Omnian webot hankkeen UKK botti",
inputTextFieldHint: "Kirjoita kysymys tähän...",
profileAvatar: "robot_icon.png",
params: {"storage": "session"} // can be set to "local" or "session". details in storage section.
})
</script>
</body>
</html>