TYK converts POST to GET when URI has duplicate slashes


#1

Tyk GW CE ver 2.7.4
Deploy API with endpoint name /testendpoint/. The API is configured to be handled by some upstream service and can handle GET/POST for /x/y/z.

tyk.conf has the “skip_url_cleaning” option set to true.

"http_server_options": {                  
    "override_defaults": false,           
    "read_timeout": 0,          
    "write_timeout": 0,                
    "use_ssl": false,          
    "use_ssl_le": false,       
    "enable_websockets": true, 
    "server_name": "localhost",
    "min_version": 771,          
    "flush_interval": 0,           
    "skip_url_cleaning": true  

},

POST /testendpoint/x/y/z works fine and returns HTTP 201 Created
< HTTP/1.1 201 Created
< Content-Length: 0
< Content-Type: application/json; charset=UTF-8
< Date: Wed, 01 May 2019 20:57:23 GMT
< X-Ratelimit-Limit: -1
< X-Ratelimit-Remaining: 0
< X-Ratelimit-Reset: 0
< Connection: close

POST /testendpoint/x/y//z (with extra /) returns HTTP 301 Moved Permanently with the new location /testendpoint/x/y/z which prompts POSTMAN to send GET /testendpoint/x/y/z
< HTTP/1.1 301 Moved Permanently
< Location: /crosswork/aaa/v1/role
< Date: Wed, 01 May 2019 20:58:27 GMT
< Content-Length: 0
< Connection: close

Question: why does TYK send HTTP 301 in this case instead of simply forwarding the request to upstream service?


#2

Filed https://github.com/TykTechnologies/tyk/issues/2262