Hi all,
I am trying to install Rasa X via docker-compose. So far everything works fine as long as I’ll point http://domain.com -> rasa
. As we need to maintain several projects within this domain, Rasa needs to be reachable under http://domain.com/help/rasa.
Unfortunately this doesn’t work, because only the login.html is being loaded, but all links to other resources as fonts, pictures, etc. are absolute.
The Architecture looks like this:
User -> Nginx (for the whole domain) -> Rasa_Nginx -> Rasa
I tried fixing the issue using the following nginx config:
# Exact URI match to load the base rasa page without a redirect
location = /help/rasa {
proxy_intercept_errors on;
proxy_pass http://rasa_nginx_1:8080/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
# Catch for all other rasa resources. Removes proxy URI before passing on
location /help/rasa {
proxy_intercept_errors on;
rewrite ^/help/rasa/(.*)$ /$1 break;
proxy_pass http://rasa_nginx_1:8080/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /static {
proxy_intercept_errors on;
proxy_pass http://rasa_nginx_1:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
Is there a way to set a base_url
in Rasa X? I couldn’t find anything.
Best
Jeronim
@akelad @Tobias_Wochinger
Any Idea from the Rasa Team would be greatly appreciated.
@plattenschieber This is the nginx config which our nginx
container is currently using:
upstream docker-stack {
server rasa-production:5005 max_fails=0;
}
upstream docker-rasax-api {
server rasa-x:5002 max_fails=0;
}
server {
listen 8080;
include /opt/bitnami/nginx/conf/conf.d/ssl.conf;
keepalive_timeout 30;
client_max_body_size 800M;
location /core/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_pass http://docker-stack/;
}
# avoid users having to change how they configure
# their credentials URLs between Rasa and Rasa X
location /webhooks/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_pass http://docker-stack/webhooks/;
}
location /socket.io {
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://docker-stack/socket.io;
}
location /api/ws {
# following https://www.serverlab.ca/tutorials/linux/web-servers-linux/how-to-configure-nginx-for-websockets/
# This directive converts the incoming connection to HTTP 1.1, which is
# required to support WebSockets. The older HTTP 1.0 spec does not provide support
# for WebSockets, and any requests using HTTP 1.0 will fail.
proxy_http_version 1.1;
# Converts the proxied connection to type Upgrade. WebSockets only communicate on
# Upgraded connections.
proxy_set_header Upgrade $http_upgrade;
# Ensure the Connection header value is upgrade
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_pass http://docker-rasax-api/api/ws;
}
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_pass http://docker-rasax-api/;
}
# pass chat message to production service if environment query parameter
# is set to `production`, or that parameter isn't set
location /api/chat$ {
if ($arg_environment = "") {
rewrite ^ /core/webhooks/rasa/webhook last;
}
if ($arg_environment = "production") {
rewrite ^ /core/webhooks/rasa/webhook last;
}
proxy_pass http://docker-rasax-api/api/chat;
}
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
}
If you prefix every location clause with a a /help/rasa
then you should get the expected result.
The other option would be to put another reverse proxy in front of everything, which redirects /help/rasa
to the rasa-x
nginx container