400 Bad request on multi-container docker setup
Hi, I've been trying since yesterday to set up the official multi-container funkwhale setup using docker-compose, but to no avail. Whenever I launch the stack and try to access it, I get a 400 Bad request error. running docker-compose logs -f
shows that only the nginx container prints an error, while the api container prints nothing, yet seems to be running normally without exiting.
nginx_1 | 172.22.0.1 - - [27/Mar/2019:16:19:18 +0000] "GET / HTTP/1.1" 400 158 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0" "[REDACTED IP]"
My .env file looks like this:
# The tag of the image we should use
# (it will be interpolated in docker-compose file)
# You can comment or ignore this if you're not using docker
FUNKWHALE_VERSION=0.18.3
# General configuration
# ---------------------
# Set this variables to bind the API server to another interface/port
# example: FUNKWHALE_API_IP=0.0.0.0
# example: FUNKWHALE_API_PORT=5678
FUNKWHALE_API_IP=127.0.0.1 (only serve to the local host, as the host's nginx server proxies to it)
FUNKWHALE_API_PORT=5000
# Replace this by the definitive, public domain you will use for
# your instance
FUNKWHALE_HOSTNAME=[REDACTED] (my domain)
FUNKWHALE_PROTOCOL=https (https is working as intended on the host's nginx server that is acting as the first proxy to the nginx container)
# Configure email sending using this variale
# By default, funkwhale will output emails sent to stdout
# here are a few examples for this setting
# EMAIL_CONFIG=consolemail:// # output emails to console (the default)
# EMAIL_CONFIG=dummymail:// # disable email sending completely
# On a production instance, you'll usually want to use an external SMTP server:
# EMAIL_CONFIG=smtp://user@:password@youremail.host:25
# EMAIL_CONFIG=smtp+ssl://user@:password@youremail.host:465
# EMAIL_CONFIG=smtp+tls://user@:password@youremail.host:587
EMAIL_CONFIG=[REDACTED] (mailgun access settings)
# The email address to use to send system emails.
DEFAULT_FROM_EMAIL=[REDACTED] (valid email for my domain)
# Depending on the reverse proxy used in front of your funkwhale instance,
# the API will use different kind of headers to serve audio files
# Allowed values: nginx, apache2
REVERSE_PROXY_TYPE=nginx
# Where media files (such as album covers or audio tracks) should be stored
# on your system?
# (Ensure this directory actually exists)
MEDIA_ROOT=/srv/funkwhale/data/media
# Where static files (such as API css or icons) should be compiled
# on your system?
# (Ensure this directory actually exists)
STATIC_ROOT=/srv/funkwhale/data/static
# which settings module should django use?
# You don't have to touch this unless you really know what you're doing
DJANGO_SETTINGS_MODULE=config.settings.production
# Generate one using `openssl rand -base64 45`, for example
DJANGO_SECRET_KEY=[REDACTED] (generated using above command)
# You don't have to edit this, but you can put the admin on another URL if you
# want to
# DJANGO_ADMIN_URL=^api/admin/
# Sentry/Raven error reporting (server side)
# Enable Raven if you want to help improve funkwhale by
# automatically sending error reports our Sentry instance.
# This will help us detect and correct bugs
RAVEN_ENABLED=false
RAVEN_DSN=https://44332e9fdd3d42879c7d35bf8562c6a4:0062dc16a22b41679cd5765e5342f716@sentry.eliotberriot.com/5
# In-place import settings
# You can safely leave those settings uncommented if you don't plan to use
# in place imports.
# Typical docker setup:
MUSIC_DIRECTORY_PATH=/music
MUSIC_DIRECTORY_SERVE_PATH=/srv/funkwhale/data/music
FUNKWHALE_FRONTEND_PATH=/srv/funkwhale/front/dist
# Nginx related configuration
NGINX_MAX_BODY_SIZE=100M
Here is my host's nginx configuration:
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name [REDACTED];
error_log /var/log/nginx/funkwhale.error.log error;
access_log /var/log/nginx/funkwhale.access.log;
location / {
proxy_pass http://localhost:5000;
client_max_body_size 100M;
client_body_buffer_size 100M;
proxy_set_header Host $http_x_forwarded_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header X-Forwarded-Host $http_x_forwarded_host;
proxy_set_header X-Forwarded-Port $http_x_forwarded_port;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
if ($scheme != "https") {
return 301 https://$host$request_uri;
}
}
server {
listen 80;
listen [::]:80;
server_name [REDACTED];
return 301 https://$host$request_uri;
}
I have found issue #700 (closed) mentioning as similar problem, but I am in fact running a reverse proxy (with https) and as I understand it, the DJANGO_ALLOWED_HOSTS variable is no longer necessary. Maybe I have missed something, but I'm out of things to try at this point.
Update: I also tried using the develop version, but the same thing happens.