kerberos-io / web

(DEPRECATED) An open source GUI to configure the machinery and to view events that were detected by the machinery.
https://www.kerberos.io
226 stars 69 forks source link

Using the Web App from a Subdirectory on Nginx #145

Open jradxl opened 5 years ago

jradxl commented 5 years ago

I have the Web App working fine (I think) in a generic installation in a subdirectory on Nginx except for the On/Off button and Update profile both on top right. The on/off button does nothing (ie no message) and the Update Profile just shows a centre screen rectangle with a permanent busy circle. I'm not knowledgeable about Laravel applications and wondered if you'd say what might be different about those two menu items, and suggest any improvement to the location clauses shown below. Of course, it might not be the nginx config, just that the app can't find something or permissions are wrong. Thanks (There are nested location blocks below, but they aren't causing an issue - i just need them because of other things on the same server.)

    location ^~ /kba
    {
        location   /kba
        {
            alias   /var/www/nginx/kba/public;
            index  index.php;

            try_files $uri $uri/ @kba;

            location ~ \.php$
            {
                try_files $uri =404; 
                fastcgi_pass   unix:/var/run/php/php7.2-fpm.sock;
                fastcgi_index  index.php;
                include        fastcgi_params;
                fastcgi_param  SCRIPT_FILENAME $request_filename;
            }
        }
    }

    location @kba 
    {
        rewrite   /kba(.*)$   /kba/index.php?$1  last;
    }
andrestl commented 5 years ago

I do have the same problem. I would be willing to work on this problem.

I think the product needs a configurable field to set up the front host URL.

example: https://has.mysite.com/frontdoor -> NIGINX -> http://10.0.0.1:8890/<kerberos_io/

Currently, the system builds the pages from 10.0.0.1:8890/ point of view. This breaks all the link back to the site.

Using proper relative path where possible and front host URL property, It would be possible to run kerberos.io under a single SSL certificate under a subdirectory.

https://has.mysite.com/frontdoor https://has.mysite.com/backyard

I have tried to do response rewrite of javascript, HTML, etc using sub_filter in NGINX. Almost got it working but ran into a very strange problem within the javascript. I have tried with upstream NGINX 1.14. It was cleaner than using subfilter alone but I ran into subtle problems.

So, Front Host URL would do the trick.