github.com/hellofresh/janus@v0.0.0-20230925145208-ce8de8183c67/docs/proxy/request_http_method.md (about) 1 #### Request HTTP method 2 3 Client requests can also be routed depending on their 4 HTTP method by specifying the `methods` field. By default, Janus will route a 5 request to an API regardless of its HTTP method. But when this field is set, 6 only requests with the specified HTTP methods will be matched. 7 8 This field also accepts multiple values. Here is an example of an API allowing 9 routing via `GET` and `HEAD` HTTP methods: 10 11 ```json 12 { 13 "name": "My API", 14 "proxy": { 15 "strip_path" : true, 16 "listen_path": "/hello/*", 17 "upstreams" : { 18 "balancing": "roundrobin", 19 "targets": [ 20 {"target": "http://my-api.com"} 21 ] 22 }, 23 "methods": ["GET", "HEAD"] 24 } 25 } 26 ``` 27 28 Such an API would be matched with the following requests: 29 30 ```http 31 GET / HTTP/1.1 32 Host: 33 ``` 34 35 ```http 36 HEAD /resource HTTP/1.1 37 Host: 38 ``` 39 40 But would not match a `POST` or `DELETE` request. This allows for much more 41 granularity when configuring APIs and Middlewares. For example, one could imagine 42 two APIs pointing to the same upstream service: one API allowing unlimited 43 unauthenticated `GET` requests, and a second API allowing only authenticated 44 and rate-limited `POST` requests (by applying the authentication and rate 45 limiting plugins to such requests).