janus icon indicating copy to clipboard operation
janus copied to clipboard

Multiple endpoint definitions on a single file wrong behaves

Open aniskhan001 opened this issue 7 years ago • 5 comments

Hey, I was trying to add multiple endpoints in a single file.

Here is my config:

[
    {
        "name": "root",
        "active": true,
        "proxy": {
            "listen_path": "/v1/",
            "upstreams": {
                "balancing": "roundrobin",
                "targets": [
                    { "target": "http://192.168.0.82:3000" }
                ]
            },
            "methods": ["GET"]
        }
    },

    {
        "name": "get-user-promo-id",
        "active": true,
        "proxy": {
            "listen_path": "/v1/promo/{id}",
            "upstreams": {
                "balancing": "roundrobin",
                "targets": [
                    { "target": "http://192.168.0.82:3000/userpromo/{id}" }
                ]
            },
            "methods": ["GET"]
        }
    },

    {
        "name": "get-company-promo",
        "active": true,
        "proxy": {
            "listen_path": "/v1/promo/",
            "upstreams": {
                "balancing": "roundrobin",
                "targets": [
                    { "target": "http://192.168.0.82:3000/promo" }
                ]
            },
            "methods": ["GET"]
        }
    }
]

I found that it works only for the last defined endpoint, in this case, "get-company-promo". First two don't work. I tried to change the arrangement of them. But it always works for the last one only.

Janus version: 3.5.0 Running this from a Docker container on a Mac.

aniskhan001 avatar Feb 15 '18 16:02 aniskhan001

@aniskhan001 what is the persistence storage implementation you are using?

rafaeljesus avatar Feb 15 '18 16:02 rafaeljesus

I'm using a compose file. These are the volumes I'm using for janus service.

    volumes:
      - ./janus.toml:/etc/janus/janus.toml
      - ./apis:/etc/janus/apis

aniskhan001 avatar Feb 15 '18 19:02 aniskhan001

can confirm this with the latest rc

eloo avatar Apr 03 '18 07:04 eloo

I am also getting the same issue. is there any fix for this ?

vithubati avatar Jul 29 '21 02:07 vithubati

never mind. in my case i used the same name for both endpoints. so please make sure you dont use duplicate names when you define endpoints

vithubati avatar Jul 29 '21 03:07 vithubati