Skipper: Help Requested

Created on 14 Feb 2017  路  9Comments  路  Source: zalando/skipper

Help Requested:

Newbee with skipper

trying to user skipper for first time and having hard time coming up with1

  • multi-route eskip file (with no example on how this is done, i thought this would work)
    hello: Path("/hello") -> "https://www.google.com"
    hello1: Path("/") -> "https://www.yahoo.com"

  • tried to pass in multiple eskip files to main using the -routes-file ex: -routes-file example.eskip example1.eskip with no success

  • eskip file with one route works fine, updating the eskip file and expecting the route to be reflected does not work.

Any pointers/suggestions would be greatly appreciated

thanks in advance
kris

Most helpful comment

  1. mixing GET vs Proxy GET

not completely sure about the exact question but the example in the explanation is pretty much possible. Once you need to make sure to match not only a particular path with Path("/hello"), but a subtree, e.g. Path("/hello/**") or PathSubtree("/hello") as a shortcut. This is called a 'predicate'. Then you probably want to trim the matching path with a 'filter': modPath("^/hello", ""). Also, not that you can use 'catch-all' predicates for routes where you don't need constraints, just want to match last for 'all other requests'. The routing this way would look like this:

hello: PathSubtree("/hello") -> modPath("^/hello", "") -> "https://www.google.com";
hello1: * -> "https://www.yahoo.com";

(i haven't tested this one)

All 9 comments

I believe you're only missing the ; after each route line, for ex.:

hello: Path("/hello") -> "https://www.google.com";
hello1: Path("/") -> "https://www.yahoo.com";

I tested this locally:

$ skipper -routes-file example.eskip 
[APP]INFO[0000] metrics listener on :9911/metrics            
[APP]INFO[0000] proxy listener on :9090                      
[APP]INFO[0000] certPathTLS or keyPathTLS not found, defaulting to HTTP 
[APP]INFO[0000] route settings, update, route: hello: Path("/hello") -> "https://www.google.com" 
[APP]INFO[0000] route settings, update, route: hello1: Path("/") -> "https://www.yahoo.com" 
[APP]INFO[0000] route settings received                      
[APP]INFO[0000] route settings applied   

And my example.eskip file:

$ cat example.eskip 
hello: Path("/hello") -> "https://www.google.com";
hello1: Path("/") -> "https://www.yahoo.com";

Can you try this?

Thank you !! The above suggestion works
hello: Path("/hello") -> "https://www.google.com";
hello1: Path("/") -> "https://www.yahoo.com";

Awesome
couple more questions

  1. Any suggestion on how to be able to dynamically load the changes to the example.eskip file when I add a new route?
  2. Is there a way to mix routing with a simple GET vs a Proxy GET, for example the case of "hello1" above displays "yahoo.com" however the css and images etc are gone. I guess if we do a reverse-proxy mechanism it would work. Is there a way to drive this behavior from configuration or we need a separate router for that or what is the preferred way to achieve this?

thanks in advance

  1. dynamic changes from the routes file:
    follow this issue: https://github.com/zalando/skipper/pull/257

if this is really critical, maybe a simple polling implementation can do the job temporarily, but currently it is not supported. For dynamic loading, the primary solution is to use etcd, which is also a better choice in a distributed environment.

@aryszka
Thanks for the pointer to the issue on reload, will explore the options provided there. Any suggestions on the stylesheet issues? Yahoo.com is just an example, something i am working will have an authenticated site which ofcourse will have css etc and would want to see all the assets properly displayed.

Any suggestions on how to go about it?

thanks in advance
kris

  1. mixing GET vs Proxy GET

not completely sure about the exact question but the example in the explanation is pretty much possible. Once you need to make sure to match not only a particular path with Path("/hello"), but a subtree, e.g. Path("/hello/**") or PathSubtree("/hello") as a shortcut. This is called a 'predicate'. Then you probably want to trim the matching path with a 'filter': modPath("^/hello", ""). Also, not that you can use 'catch-all' predicates for routes where you don't need constraints, just want to match last for 'all other requests'. The routing this way would look like this:

hello: PathSubtree("/hello") -> modPath("^/hello", "") -> "https://www.google.com";
hello1: * -> "https://www.yahoo.com";

(i haven't tested this one)

@aryszka
That is awesome it works really !!

Is there a good developer documentation I can refer to see some of the options available for predicates etc apart from godoc and any examples?. This is a very good framework as I can see it and would like to explore more

thanks in advance
kris

now tested, and if this is about the styling and scripting content of the pages, then it doesn't work as expected, for various reasons, that all boiles down to the difference between a reverse proxy and a transparent forward proxy (that simply just can be called a "proxy"). Skipper is the former one. Here's some examples from the above test:

  1. when we request localhost:9090/hello with the above routing, the google.com html page is loaded, but it contains absolute links to the styles and images like, /logos/doodles/2017/valentines-day-2017-day-4-5165155370401792.2-res.png. Notice the '/' at the beginning of this url, and also that it doesn't have '/hello' at the beginning. This means that the 'hello' route will never match.

  2. in case of the yahoo route, the page contains full absolute urls including the domain name for the images and styles, like https://s.yimg.com/kx/yucs/uh3s/atomic/88/css/atomic-min.css, which means that the request from the browser won't even go to skipper.

Some of these problems could be fixed by using a complicated combination of the Path() and the Host() predicates, but it wouldn't help on all the problems in the above example.

As mentioned, Skipper is not a transparent forward proxy, but a reverse proxy. It's primary use case is service composition, and not transparently forwarding requests. Sorry, if it's not good for your use case because of this. For a forward proxy scenario, a widely used product, that comes to my mind, is Squid. Maybe it can be configured to fulfil your needs, or, as you suggested it is possible to set up a combination of skipper and squid to meet your requirements.

@krism74

"Is there a good developer documentation"

Sry. I'd agree that we have a slight debt there. While we could say that we are covered by the godoc and all information can be found in it, at the current amount of features and their combination possiblities, a better user guide or manual would be also helpful. Until the docs improved, I can only recommend the godoc. And of course, always happy to answer any questions :)

For examples from other projects, currently this one comes to my mind:

https://github.com/zalando-incubator/skoap/

Towards the end of the readme, there are some eskip routes defined. This project also contains some custom filters.

Actually it looks more like what I can use for my work as I need a reverse proxy. I will explore the options available and see if it makes a fit.

thanks for all the help, will definitely post here if I need more help

thanks
kris

Was this page helpful?
0 / 5 - 0 ratings