traefik: use PathPrefixStrip and PathPrefix together - traefik

Using trafix w/ docker backend, I would like to match all URLs of form /manage/users/api... and map them into /api.... I tried:
traefik.frontend.rule=PathPrefixStrip:/manage/users;PathPrefix:/api;
But it doesn't seem to work. Is there a way to do this?

The following works:
traefik.frontend.rule=PathPrefixStrip:/manage/users/api;AddPrefix:/api;

Related

running parameterized bigquery via cell magic in jupyter notebook

I've got a problem with pydatalab: I just installed it and normal querying and charting via cell magic works fine.
The wiki for pydatalab says, it's possible to add chart controls. But that wiki uses some old %%sql syntax instead of the new %%bq query one which don't work anymore.
Weird thing is, the following works fine:
%%bq execute -q tmp_result_na
parameters:
- name: name
type: STRING
value: 'value'
Thank you (in advance) very much for your help!
I found this open issue. It's not implemented right now....

Recursive/Exploded uri variable with restlet

Does Restlet support exploded path variable (reference to URI Template RFC)?
An example would be /documents{/path*} where path can be for example "a/b/c/d/e".
This syntax doesn't seem to work with Restlet.
I'm creating a folder navigation api and I can have variable path depth, but I'm trying to have only one resource on the server side to handle all the calls. Is this something I can do with Restlet? I suppose I could create a custom router but if there is another way to do this I would like to know.
Thanks
It is possible to support this using matching modes.
For example:
myRouter.attach("/documents{path}",
MyResource.class).setMatchingMode(Template.START_WITH);
Hope this helps!
I'm doing the following
myRouter.attach("/documents/{path}", MyResource.class).setMatchingMode(Template.START_WITH);
Now I do get inside the resource GET method, but if I request the value of the path variable, I only get the first part (for example, /documents/a/b/c, path returns "a".) I use getRequest().getAttributes().get("path") to retrieve the value. Am I doing something wrong ?
Mathieu

Play framework: Dynamic routing depending on version number

I'm trying to dynamically define a version in the URI routing.
My immidiate ideas were to
a)
I've configured in the application.conf a row stating my current version:
myApp.ver = 0.1
I wan't to use it in the routes file as part of the URI, for example:
GET /myApp/{version}/welcome controller.myApp.Welcome()
The idea is not to pass the version number to the Welcome() method
but to get the version from the application.conf file.
I've searched for defining parameters in the route file but didn't find information that helped me.
b) Another idea was to have a variable in the routes, something like:
CurrentVersion = 0.1
in the routes file and use it in the URI.
How can I solve this? I havn't found an example for this.
Thanks.
If you want to do this for every route, it should be possible to set the application.baseUrl to include your version number. To do this conveniently you can define the version in your application.conf instead of the Build.scala file, as described here.
myApp.name = myApp
myApp.ver = 0.1
application.baseUrl = ${myApp.name}/${myApp.ver}
If you want to do it only for some routes, there doesn't seem to be a simple solution. If you could ignore parameters in routes, I'd say use a regexp parameter and verify it in your global router - unfortunately this doesn't seem possible without passing the parameter to the controller.
So I see two other options:
Hardcode the version number in the routes file and do a search and replace every time it changes.
Create a plugin for the sbt build process and let it replace the version in your routes file.
In Play 1.2.x, in your conf/routes file, add a route like this:
GET /myApp/${play.configuration.getProperty("myApp.ver")}/welcome myApp.Welcome()

Sqlmap inline parameters

Hi ive just hear about an error in cakephp that allows sql inyection;
https://twitter.com/cakephp/status/328610604778651649
I was trying to test my site using sqlmap, but i cant find how to specify the params.
The url i am testing is;
http://127.0.0.1/categories/index/page:1/sort:id/direction:asc
And the parameters i want to sqlmap inyect are in the url (page:,sort:,direction:)
I have try to run;
python sqlmap.py -u "http://127.0.0.1/categories/index/page:1/sort:id/direction:asc"
But nothing...
Any clue? Thanks!
In CakePHP there are passed arguments, named parameters, and querystring parameters.
Passed arguments look like .../index/arg are accessed with $this->request->pass[0], where '0' is the array index. Named parameters look like .../index/key:value and are accessed with $this->request->named['key']. Querystring parameters look like ̀.../index?key=valueand are accessed with$this->request->query['key']`.
Your URL uses named parameters so it should look like this (without the question mark):
http://127.0.0.1/categories/index/page:1/sort:id/direction:asc
Edit:
Since CakePHP uses mod_rewrite, you have to specify the parameters as explained in the sqlmap wiki.

Ruby on Rails routing: how to remove (using redirection) a URL prefix

I'm sure this is dead simple, which is why I'm so annoyed...
The problem originated from using translate_routes. This is very simple to use and presents no problem whatsoever. All I want is to be able to have the default locale prefix in the url, optionally.
Right now, I can do:
GET /controller/ and
GET /fr/controlleur/, but trying
GET /en/controller/ fails.
I figured that the en in the last example is not useful, so I want to 'remove' it using redirection. However, all my attempts up till now have failed.
How can I remove that prefix?
match "/en/*path" => redirect("/%{path}")
http://guides.rubyonrails.org/routing.html#redirection
http://guides.rubyonrails.org/routing.html#route-globbing