Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Make konga work with relative paths #21

Closed
bakstad opened this issue Feb 20, 2017 · 10 comments
Closed

Make konga work with relative paths #21

bakstad opened this issue Feb 20, 2017 · 10 comments

Comments

@bakstad
Copy link

bakstad commented Feb 20, 2017

We run konga on a cluster and at the moment rely on web paths to route traffic to the correct instance.

That means we call a URL like so: http://cluster.example.com/konga-gui/. The problem is that Konga assumes assets are found on the webroot and therefore the frontend is not loaded.

In the logs and HTML this is reflected. Notice all the /vendors.min.css, /frontend.min.js etc.

This was mentioned as a part of #14, but not fully implemented it seems. What I would like is a environment variable KONGA_FRONTEND_WEBROOT (or something more fitting) that will be prepented to all the asset paths.

HTML:


<!DOCTYPE html><html data-ng-app="frontend"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Konga</title><link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet"><link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"><link rel="stylesheet" href="/vendors.min.css"><link rel="stylesheet" href="/frontend.min.css"></head><body data-ng-cloak class="ng-cloak"><div data-ui-view="header"></div><div ng-if="isAuthenticated() && $state.name != 'admin'" class="page-head container-fluid"><div class="container"><h3 class="page-title"><span ng-bind-html="$state.data.prefix" class="page-title-prefix"></span> <span ng-bind-html="$state.data.pageName"></span>&nbsp;<div ng-show="loading" id="spinner" data-spinner="{&quot;radius&quot;: 15,&quot;strokeWidth&quot;:3}" style="display: inline-block"></div></h3><ui-breadcrumbs displayname-property="data.displayName" template-url="/frontend/core/layout/partials/uiBreadcrumbs.tpl.html"></ui-breadcrumbs></div></div><div class="container main-container"><div data-ui-view="content"></div></div><div data-ui-view="footer"></div><script>(function onLoad() {
                var io;

                Object.defineProperty(window, 'io', {
                    get: function get() {
                        return io;
                    },
                    set: function set(value) {
                        var sails;

                        io = value;

                        Object.defineProperty(io, 'sails', {
                            get: function get() {
                                return sails;
                            },
                            set: function set(value) {
                                sails = value;

                                sails.url = 'http://cluster.example.com/konga-backend';
                            }
                        });
                    }
                });

                //Logging
                window.enableLogs = 'false'

            })();</script><script src="/vendors.min.js"></script><script src="/frontend.min.js"></script></body></html>
@pantsel
Copy link
Owner

pantsel commented Feb 20, 2017

Check out the dev branch. I forgot to implement the changes in dist logic.

It should work now.

@bakstad
Copy link
Author

bakstad commented Feb 20, 2017

Could you please set up building of branches on dockerhub? That way I can test it without building my self

@pantsel
Copy link
Owner

pantsel commented Feb 20, 2017

I'll do that some time later today

@bakstad
Copy link
Author

bakstad commented Feb 21, 2017

When using the docker image locally I have problems using the plugins tab, dashboard and node info. Seem ot be getting 404 og 503s. Consumers and APIs work though.

Any ideas?

GET http://localhost:9999/kong/plugins 503 (Service Unavailable)
GET http://localhost:9999/kong/info 404 (Not Found)

started like so:

ocker run -it -p 3000:3000 -p 9999:1338 -e KONGA_BACKEND_URL=http://localhost:9999 --name konga pantsel/konga

@pantsel
Copy link
Owner

pantsel commented Feb 21, 2017

What version of Kong are you using? Is it 0.9.x?

@bakstad
Copy link
Author

bakstad commented Feb 21, 2017

We are actually stuck on 0.8.x, that might be the problem.

@pantsel
Copy link
Owner

pantsel commented Feb 21, 2017

At what ip:port is Kong's admin api exposed?

Are you using a container for Kong? In that case you will need to add a link --link kong:kong in your run command and the node you'll need to setup in Konga's settings will be http://kong:8001.

@bakstad
Copy link
Author

bakstad commented Feb 21, 2017

I'm not running Kong locally, but using Konga locally. So i'm pointing to kong on an external address.

@pantsel
Copy link
Owner

pantsel commented Feb 21, 2017

The fact that some endpoints do work and some don't, makes me think that the issue is maybe related to Kong's version. I haven't tried Konga on versions older than 0.9.x. I will have to test it and get back to you.

@bakstad
Copy link
Author

bakstad commented Feb 23, 2017

Things seem to work much better with 0.9.x, so don't worry about it.

BUt it would be nice if you could get automated build of branches.

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

No branches or pull requests

2 participants