Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gateway] add an option to encode outgoing request #2557

Closed
NicolasGeraud opened this issue Aug 28, 2019 · 1 comment

Comments

@NicolasGeraud
Copy link
Member

commented Aug 28, 2019

By default, the gateway encode/decode query parameters received in each request before send them to the backend.

Most of the time, it doesn't matter. But sometimes it causes errors.

We think that the gateway must be as transparent as possible and this behavior must not be the default behavior.
On the other hand we have to insure backward compatibility and encoding the outgoing request could be a feature of the gateway.

So we change the default behavior on how query parameters are handled and we will provide a script to configure legacy apis during the upgrade to configure them with the old mode.

Your Environment

  • Version used: 1.25.10
@NicolasGeraud NicolasGeraud added this to the APIM - 1.25.11 milestone Aug 28, 2019
@NicolasGeraud NicolasGeraud self-assigned this Aug 28, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-gateway-api that referenced this issue Aug 28, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-gateway that referenced this issue Aug 28, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-gateway-api that referenced this issue Aug 30, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-definition that referenced this issue Aug 30, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-common that referenced this issue Aug 30, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-gateway that referenced this issue Aug 30, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-gateway that referenced this issue Aug 30, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-management-rest-api that referenced this issue Sep 3, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-definition that referenced this issue Sep 3, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-gateway that referenced this issue Sep 3, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-management-webui that referenced this issue Sep 3, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-gateway that referenced this issue Sep 3, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-gateway that referenced this issue Sep 4, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-common that referenced this issue Sep 4, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-gateway that referenced this issue Sep 4, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-gateway that referenced this issue Sep 4, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-common that referenced this issue Sep 4, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-gateway that referenced this issue Sep 4, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-management-rest-api that referenced this issue Sep 9, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-policy-transformqueryparams that referenced this issue Sep 10, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-policy-transformqueryparams that referenced this issue Sep 10, 2019
tcompiegne added a commit to gravitee-io/gravitee-policy-transformqueryparams that referenced this issue Sep 10, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-policy-dynamic-routing that referenced this issue Sep 12, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-gateway that referenced this issue Sep 16, 2019
@NicolasGeraud

This comment has been minimized.

Copy link
Member Author

commented Sep 16, 2019

Notes

We introduce 2 options :

  • a legacy mode (you have to enable it at the gateway level) to have the same behavior than before
legacy:
# Enable this parameter if you want the gateway act like version <1.25.11 .
#  See https://github.com/gravitee-io/issues/issues/2557
  decode-url-params: true #you should not need to activate this.
  • an endpoint http configuration to encode outgoing request

By default, you should not need those options. The gateway will send request with the same encoding they received.

Here are tests to understand how the gateway worked previously and how it works now :

Direct call

curl                       /echo/ab%20cd%3Def?a&b=&c==3
1.25.10                    /echo/ab%20cd%3Def?a&b&c=%3D3
fix, encoded=false         /echo/ab%20cd%3Def?a&b=&c==3
fix, encoded=true          /echo/ab%2520cd%253Def?a&b=&c=%3D3
fix, legacy=true           /echo/ab%20cd%3Def?a&b&c=%3D3
curl                       /echo/ab%20cd=ef?a&b=&c==3
1.25.10                    /echo/ab%20cd=ef?a&b&c=%3D3
fix, encoded=false         /echo/ab%20cd=ef?a&b=&c==3
fix, encoded=true          /echo/ab%2520cd=ef?a&b=&c=%3D3
fix, legacy=true           /echo/ab%20cd=ef?a&b&c=%3D3
curl                       /echo/?foo=bar;bar=foo
1.25.10                    /echo/?foo=bar&bar=foo
fix, encoded=false         /echo/?foo=bar&bar=foo
fix, encoded=true          /echo/?foo=bar&bar=foo
fix, legacy=true           /echo/?foo=bar&bar=foo
curl                       /echo/a%2Fb/c?a=/b%2Fc
1.25.10                    /echo/a%2Fb/c?a=%2Fb%2Fc
fix, encoded=false         /echo/a%2Fb/c?a=/b%2Fc
fix, encoded=true          /echo/a%252Fb/c?a=%2Fb%252Fc
fix, legacy=true           /echo/a%2Fb/c?a=%2Fb%2Fc
curl                       /echo/filter=Name+=+%28%27CS-S%26C-ZAS%27%29&layout=Id,Name
1.25.10                    /echo/filter=Name+=+%28%27CS-S%26C-ZAS%27%29&layout=Id,Name
fix, encoded=false         /echo/filter=Name+=+%28%27CS-S%26C-ZAS%27%29&layout=Id,Name
fix, encoded=true          /echo/filter=Name+=+%2528%2527CS-S%2526C-ZAS%2527%2529&layout=Id,Name
fix, legacy=true           /echo/filter=Name+=+%28%27CS-S%26C-ZAS%27%29&layout=Id,Name

Using the dynamic-routing policy

policy config                {#endpoints['default']}/ab%20cd%3Def?a&b=&c==3
1.25.10 - rawPath = false             /echo/ab%20cd=ef?a&b&c=%3D3
1.25.10 - rawPath = true              /echo/ab%20cd%3Def?a&b&c=%3D3
fix, encoded=false                    /echo/ab%20cd%3Def?a&b=&c==3
fix, encoded=true                     /echo/ab%2520cd%253Def?a&b=&c=%3D3
fix, legacy=true                      /echo/ab%20cd%3Def?a&b&c=%3D3
policy config                {#endpoints['default']}/ab%20cd=ef?a&b=&c==3
1.25.10 - rawPath = false             /echo/ab%20cd=ef?a&b&c=%3D3
1.25.10 - rawPath = true              /echo/ab%20cd=ef?a&b&c=%3D3
fix, encoded=false                    /echo/ab%20cd=ef?a&b=&c==3
fix, encoded=true                     /echo/ab%2520cd=ef?a&b=&c=%3D3
fix, legacy=true                      /echo/ab%20cd=ef?a&b&c=%3D3
policy config                {#endpoints['default']}?foo=bar;bar=foo
1.25.10 - rawPath = false             /echo?foo=bar&bar=foo
1.25.10 - rawPath = true              /echo?foo=bar&bar=foo
fix, encoded=false                    /echo?foo=bar&bar=foo
fix, encoded=true                     /echo?foo=bar&bar=foo
fix, legacy=true                      /echo?foo=bar&bar=foo
policy config                {#endpoints['default']}/a%2Fb/c?a=/b%2Fc
1.25.10 - rawPath = false             /echo/a/b/c?a=%2Fb%2Fc
1.25.10 - rawPath = true              /echo/a%2Fb/c?a=%2Fb%2Fc
fix, encoded=false                    /echo/a%2Fb/c?a=/b%2Fc
fix, encoded=true                     /echo/a%252Fb/c?a=%2Fb%252Fc
fix, legacy=true                      /echo/a%2Fb/c?a=%2Fb%252Fc
policy config                {#endpoints['default']}/filter=Name+=+%28%27CS-S%26C-ZAS%27%29&layout=Id,Name
1.25.10 - rawPath = false             /echo/filter=Name+=+('CS-S&C-ZAS')&layout=Id,Name
1.25.10 - rawPath = true              /echo/filter=Name+=+%28%27CS-S%26C-ZAS%27%29&layout=Id,Name
fix, encoded=false                    /echo/filter=Name+=+%28%27CS-S%26C-ZAS%27%29&layout=Id,Name
fix, encoded=true                     /echo/filter=Name+=+%2528%2527CS-S%2526C-ZAS%2527%2529&layout=Id,Name
fix, legacy=true                      /echo/filter=Name+=+%28%27CS-S%26C-ZAS%27%29&layout=Id,Name
tcompiegne added a commit to gravitee-io/gravitee-definition that referenced this issue Sep 18, 2019
tcompiegne added a commit to gravitee-io/gravitee-common that referenced this issue Sep 18, 2019
tcompiegne added a commit to gravitee-io/gravitee-gateway-api that referenced this issue Sep 18, 2019
tcompiegne added a commit to gravitee-io/gravitee-gateway that referenced this issue Sep 18, 2019
tcompiegne added a commit to gravitee-io/gravitee-management-rest-api that referenced this issue Sep 18, 2019
tcompiegne added a commit to gravitee-io/gravitee-management-webui that referenced this issue Sep 18, 2019
NicolasGeraud added a commit to gravitee-io/gravitee-policy-dynamic-routing that referenced this issue Sep 18, 2019
tcompiegne added a commit to gravitee-io/gravitee-policy-dynamic-routing that referenced this issue Sep 18, 2019
@tcompiegne tcompiegne closed this Sep 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
API Management
Awaiting triage
2 participants
You can’t perform that action at this time.