You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/05/12 02:13:10 UTC

[GitHub] [apisix] riskgod opened a new issue #4222: request help: redirect can't support POST

riskgod opened a new issue #4222:
URL: https://github.com/apache/apisix/issues/4222


   hey, I set a new router use `redirect` plugin, but it shows `GET` after redirect the router
   ####  Setup upstearm
   ```
   curl http://127.0.0.1:9080/apisix/admin/upstreams/100  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -i -X PUT -d '
   {
       "type":"roundrobin",
       "nodes":{
           "127.0.0.1:8081": 1
       }
   }'
   ```
   
   #### setup router
   ```
   curl http://127.0.0.1:9080/apisix/admin/routes/119 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "methods": ["POST"],
       "uri": "/checkCoinAddress",
       "plugins": {
           "redirect": {
               "uri": "/checkAddress",
               "ret_code": 301
           },
           "jwt-auth":{},
           "consumer-restriction": {
               "whitelist": [
                   "jeff"
               ]
           }
       },
       "upstream_id": "100"
   }'
   ```
   After call this router, it shows 404 router not found. 
   <img width="425" alt="Screen Shot 2021-05-12 at 10 11 28 AM" src="https://user-images.githubusercontent.com/3436287/117908055-6d50f880-b30a-11eb-8f5a-7eca3a29653f.png">
   After debug, why `checkAddress` is `GET`, And how to set it to `POST`?
   <img width="581" alt="Screen Shot 2021-05-12 at 10 10 23 AM" src="https://user-images.githubusercontent.com/3436287/117907960-47c3ef00-b30a-11eb-84f6-52fc73329205.png">
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] riskgod closed issue #4222: request help: redirect can't support POST

Posted by GitBox <gi...@apache.org>.
riskgod closed issue #4222:
URL: https://github.com/apache/apisix/issues/4222


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on issue #4222: request help: redirect can't support POST

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #4222:
URL: https://github.com/apache/apisix/issues/4222#issuecomment-839394442


   It is your client to decide to use GET after redirect.
   
   If your client supports 308, you can use 308 instead. See the difference between 301 and 308:
   
   > The request method and the body will not be altered, whereas 301 may incorrectly sometimes be changed to a GET method.
   
   https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org