motiv-labs / janus

An API Gateway written in Go
https://hellofresh.gitbooks.io/janus
MIT License
2.77k stars 319 forks source link

Duplicated route declaration allowed? #478

Open Leonardo-Ferreira opened 3 years ago

Leonardo-Ferreira commented 3 years ago

take a look at this sample:

[
    {
    "name" : "example",
    "active" : true,
    "proxy" : {
        "preserve_host" : false,
        "listen_path" : "/example/*",
        "upstreams" : {
            "balancing": "roundrobin",
            "targets": [
                {"target": "http://localhost:8081/echo"}
            ]
        },
        "strip_path" : false,
        "append_path" : false,
        "methods" : ["GET"]
    }
},
{
    "name" : "example2",
    "active" : true,
    "proxy" : {
        "preserve_host" : false,
        "listen_path" : "/example/*",
        "upstreams" : {
            "balancing": "roundrobin",
            "targets": [
                {"target": "http://microsoft.com/"}
            ]
        },
        "strip_path" : false,
        "append_path" : false,
        "methods" : ["GET"]
    }
}
]

it declares 2 apis, with different targets, but the same base path.

This does generate an error, what happens is that the first one is over... in my opinion this should generate an error because in big environments this can lead to bugs and erros that are very difficult to trace