Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KITANA DOCKER - MIXED CONTENT ERROR #26

Closed
cyb3rgh05t opened this issue Dec 29, 2019 · 20 comments
Closed

KITANA DOCKER - MIXED CONTENT ERROR #26

cyb3rgh05t opened this issue Dec 29, 2019 · 20 comments

Comments

@cyb3rgh05t
Copy link
Contributor

cyb3rgh05t commented Dec 29, 2019

hey,

i need some help regarding KITANA DOCKER.

i am running Kitana over nginx proxy server with a specific subdomain, but when i load the page i get an error in google_chrome.

UNSAFE SCRIPTS

image

does somebody know how i can fix this?

My Nginx Config looks like this:

`#Upstream to kitana
upstream kitana {
server ip_to_server:65535;
keepalive 32;
}

server {
listen 443 http2 ssl;

server_name kitana.mystreamnet.club;
    
    include snippets/ssl-params.conf;

    send_timeout 100m;

ssl_certificate /etc/letsencrypt/live/kitana.mystreamnet.club/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/kitana.mystreamnet.club/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/kitana.mystreamnet.club/fullchain.pem;

gzip on;
gzip_vary on;
gzip_min_length 1000;
gzip_proxied any;
gzip_types text/plain text/css text/xml application/xml text/javascript application/x-javascript image/svg+xml;
gzip_disable "MSIE [1-6]\.";

client_max_body_size 100M;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
proxy_buffering off;

    location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}


location / {
          proxy_pass http://kitana;
}

}

server {
listen 80;
listen [::]:80;
server_name kitana.mystreamnet.club;
return 301 https://$server_name$request_uri;
}`

Thanks in advance..

@pannal
Copy link
Owner

pannal commented Dec 30, 2019

Try adding -P to the command line of kitana and see whether that helps. This tells Kitana to assume it runs behind a reverse proxy, which it does in your case.

@pannal
Copy link
Owner

pannal commented Dec 30, 2019

You might also need -PB https://kitana.mystreamnet.club (maybe with a / at the end), but try with -P only first.

@cyb3rgh05t
Copy link
Contributor Author

cyb3rgh05t commented Dec 30, 2019

thanks for the reply... :)

I'm sorry but i not really sure what you mean with your suggestion?
I am new to proxies and docker stuff :( i am using installing everything over plexgude project.
So everyhing is setup under portainer.

Using a .yml file to install kitana:

`
#!/bin/bash

  • hosts: localhost
    gather_facts: false
    tasks:

    FACTS

    • name: 'Set Known Facts'
      set_fact:
      pgrole: 'kitana'
      intport: '31337'
      extport: '31337'
      image: 'pannal/kitana'

    CORE (MANDATORY)

    • name: 'Including cron job'
      include_tasks: '/opt/plexguide/containers/_core.yml'

    LABELS

    • name: 'Adding Traefik'
      set_fact:
      pg_labels:
      traefik.frontend.auth.forward.address: '{{gauth}}'
      traefik.enable: 'true'
      traefik.port: '{{intport}}'

      traefik.frontend.rule: 'Host:{{pgrole}}.{{domain.stdout}},{{tldset}}'
      
    • name: 'Setting PG Volumes'
      set_fact:
      pg_volumes:
      - '/var/run/docker.sock:/var/run/docker.sock'
      - '/etc/localtime:/etc/localtime:ro'
      - '/opt/appdata/{{pgrole}}:/data'

    • name: 'Setting PG ENV'
      set_fact:
      pg_env:
      PUID: 1000
      PGID: 1000

    MAIN DEPLOYMENT

    • name: 'Deploying {{pgrole}}'
      docker_container:
      name: '{{pgrole}}'
      image: '{{image}}'
      pull: yes
      published_ports:
      - '{{ports.stdout}}{{extport}}:{{intport}}'
      volumes: '{{pg_volumes}}'
      env: '{{pg_env}}'
      restart_policy: unless-stopped
      networks:
      - name: plexguide
      aliases:
      - '{{pgrole}}'
      state: started
      labels: '{{pg_labels}}'
      `

@pannal
Copy link
Owner

pannal commented Dec 30, 2019

Well you need to change the way the Kitana container starts: https://github.com/pannal/Kitana#mount-on-kitana-and-behind-a-reverse-proxy-example-nginx

It needs -P at least to work behind a reverse proxy as a command line parameter.

@pannal
Copy link
Owner

pannal commented Dec 30, 2019

I've never used portainer, judging from the wiki, it only supports overwriting the command used, not the option to add parameters.

You can try setting the command to python kitana.py -P on the kitana container.

@cyb3rgh05t
Copy link
Contributor Author

ok thank you, i will see if i could figure it out.

thanks for taking time

@cyb3rgh05t
Copy link
Contributor Author

cyb3rgh05t commented Dec 30, 2019

allright got it :)

image

i really appreciate that you took some time to help me out :)

Looks great now. thanks for your amazing work.

image

Thanks a lot and happy new year :)

@pannal
Copy link
Owner

pannal commented Dec 30, 2019

Ah can you detail how you entered the necessary data into the interface? I'll add that to the README then.

@pannal pannal reopened this Dec 30, 2019
@pannal
Copy link
Owner

pannal commented Dec 31, 2019

@cyb3rgh05t?

@cyb3rgh05t
Copy link
Contributor Author

cyb3rgh05t commented Jan 2, 2020

Sorry i was away for a few days :(

First i opened kitana docker in portainer to get the container details.
Then i clicked on DUPLICATE/EDIT option.

image

In ADVANCED SETTINGS i added the command '-B' '0.0.0.0:31337' '-P' in the COMMAND field.

image

then i redeployed the container

image

image

@saitoh183
Copy link

@cyb3rgh05t

Thank you for sharing

@pannal

You should add this to the Wiki as many people use portainer as there docker frontend

@saitoh183
Copy link

saitoh183 commented Jan 8, 2020

im trying to get it to work with reverse proxy nginx (Linuxserver Letsencrypt container. Since i know it needs the folder static. I created a volume in the LE container that points to the content of /app of kitana (ls from within the LE container)
image

Nginx config

#Kitana
server {
    listen 443 ssl;

    server_name kitana.*;
	#proxy_redirect off;

    include /config/nginx/ssl.conf;
	
	location ^~/kitana/pms_asset {
        expires 1M;
        access_log off;
        add_header Cache-Control "public";
        proxy_pass http://<redacted>:31337;
        include /config/nginx/proxy.conf;
    }

    location ^~/kitana/static/  {
        root /kitana/static;

        # versioned static rewrite
        rewrite "^(\/kitana\/static\/(css|js|img)\/)(\w+)\.\w{7}\.(\w{2,4})$" $1$3.$4 last;
    }
    location / {
        proxy_pass http://<redacted>:31337;
    }
}

Result :
image

I dont have proxy_redirect off because then i get redirected to my IP: and not secured

@pannal
Copy link
Owner

pannal commented Jan 11, 2020

No idea to be honest. Does NGINX like spaces after the location comparator?

@saitoh183
Copy link

No idea to be honest. Does NGINX like spaces after the location comparator?

It shouldnt matter cuz if it did , it wouldnt start up properly

@pannal
Copy link
Owner

pannal commented Jan 18, 2020

Well, if it works without NGINX in front of it, it's not Kitana's fault.

My NGINX reverse proxy config looks like this:

location ^~ /kitana/pms_asset {
        expires 1M;
        access_log off;
        add_header Cache-Control "public";
        proxy_pass http://127.0.0.1:31337;
        include proxy.conf;
        add_header Transport 'dynamic';
    }

    location ^~ /kitana/static/  {
        root /bulk/;

        # versioned static rewrite
        rewrite "^(\/kitana\/static\/(css|js|img)\/)(\w+)\.\w{7}\.(\w{2,4})$" $1$3.$4 last;
    }

    location /kitana/ {
        proxy_pass http://127.0.0.1:31337;
        include proxy.conf;
        add_header Transport 'dynamic';
    }

@saitoh183
Copy link

i will try your config...i know its not kitana, its nginx but i couldnt find the way to add it properly

@saitoh183
Copy link

It works :)

thanks @pannal

@pannal pannal closed this as completed Feb 2, 2020
@TristBella
Copy link

Maybe you guys can help me. I have kitana installed and working without NGINX. I also use Portainer and have it set as above. When i add to NGINX, even using pannal config, it will 404. https://domain.com/kitana will work till it goes to https://domain.com/token. So I added "token" into the config. Now it craps out at https://domain.com/choose_plugin?XXXXXXXXXXXX. Am I going to need to add every "location" that kitana is looking for? Just for the heck of it, I have also added a volume to the kitana data from the letsencrypt container.

`location ^~ /kitana/pms_asset {
expires 1M;
access_log off;
add_header Cache-Control "public";
proxy_pass http://127.0.0.1:31337;
include /config/nginx/proxy.conf;
add_header Transport 'dynamic';
}

location ^~ /kitana/static/  {
    root /bulk/;

    # versioned static rewrite
    rewrite "^(\/kitana\/static\/(css|js|img)\/)(\w+)\.\w{7}\.(\w{2,4})$" $1$3.$4 last;
}

location /kitana/ {
    proxy_pass http://127.0.0.1:31337;
    include /config/nginx/proxy.conf;
    add_header Transport 'dynamic';
}

location /token {
	proxy_pass http://127.0.0.1:31337/token;
    include /config/nginx/proxy.conf;
    add_header Transport 'dynamic';
}`

@pannal
Copy link
Owner

pannal commented Feb 28, 2020

You didn't set the prefix and/or behind proxy mode. Please see Readme.

@lgkahn
Copy link

lgkahn commented Feb 5, 2022

trying to run on windows for plex all requirements ment and installed i get this error
E:\kitana>python3.9 kitana.py
Traceback (most recent call last):
File "E:\kitana\kitana.py", line 28, in
from plugins.SassCompilerPlugin import SassCompilerPlugin
ModuleNotFoundError: No module named 'plugins'

E:\kitana>
thanks

also cannot install it.. updated pip to latest

E:\kitana>pip3.9 install plugins
ERROR: Could not find a version that satisfies the requirement plugins (from versions: none)
ERROR: No matching distribution found for plugins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants