kitsu-docker icon indicating copy to clipboard operation
kitsu-docker copied to clipboard

custom nginx container doesn't work well with kitsu

Open paullam328 opened this issue 3 years ago • 0 comments

Here's my custom nginx server running in another Docker container:

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 1024;
}

http {
    server {
        listen 80;
        server_name localhost 127.0.0.1;

        error_page 404 = @foobar;

        location @foobar {
            return 301 /; # 301 (redirect) if not found
        }

        # Declare proxies:
        location /api/ {
            proxy_pass http://<host-url>:5000/api/;
        }
        
        location /kitsu/ {
            sub_filter 'src=/css/' 'src=/kitsu/css/';
            sub_filter 'src=/js/' 'src=/kitsu/js/';
            sub_filter_once off;
            proxy_pass http://<host-url>:5000/;
        }

        # Use Access-Control-Allow-Origin header to allow pre-flight request checks
        location ~* \.(eot|otf|ttf|woff|woff2)$ {
            add_header Access-Control-Allow-Origin *;
        }
    }
}

All the Kitsu css/js files somehow ended up in /css/ and /js/ directories instead of /kitsu/css/ and /kitsu/js/ directories, which causes 404 whenever I connect to Kitsu.

paullam328 avatar Mar 23 '22 16:03 paullam328