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

Error 400, IllegalArgumentException in dynamic routing #2875

Closed
schulm opened this issue Nov 13, 2019 · 7 comments
Closed

Error 400, IllegalArgumentException in dynamic routing #2875

schulm opened this issue Nov 13, 2019 · 7 comments

Comments

@schulm
Copy link

@schulm schulm commented Nov 13, 2019

We have upgraded from 1.25.2 to 1.29.5 and we are experiencing following issue. An internal error

Expected Behavior

Should work.

Current Behavior

We are getting a 400 from the client, no exception in logfile, in api logs we are getting this Exception.

IllegalArgumentException java.lang.IllegalArgumentException: Illegal character in path at index 76: https://localhost:8383/couchdb/maptiles/_design/maptiles/_rewrite/fonts/Noto Sans Regular/0-255.pbf at java.base/java.net.URI.create(URI.java:883) at io.gravitee.gateway.core.invoker.EndpointInvoker.buildURI(EndpointInvoker.java:152) at io.gravitee.gateway.core.invoker.EndpointInvoker.invoke(EndpointInvoker.java:79) at io.gravitee.gateway.handlers.api.ApiReactorHandler.handleProxyInvocation(ApiReactorHandler.java:120) at io.gravitee.gateway.handlers.api.ApiReactorHandler.lambda$handleClientRequest$1(ApiReactorHandler.java:93) at io.gravitee.gateway.core.processor.chain.AbstractStreamableProcessorChain.handle(AbstractStreamableProcessorChain.java:67) at io.gravitee.gateway.core.processor.chain.AbstractStreamableProcessorChain.lambda$handle$1(AbstractStreamableProcessorChain.java:55) at io.gravitee.gateway.policy.impl.PolicyChain.doNext(PolicyChain.java:89) at io.gravitee.gateway.policy.impl.StreamablePolicyChain.doNext(StreamablePolicyChain.java:54) at io.gravitee.policy.dynamicrouting.DynamicRoutingPolicy.onRequest(DynamicRoutingPolicy.java:123) at jdk.internal.reflect.GeneratedMethodAccessor327.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at io.gravitee.gateway.policy.impl.PolicyImpl.invoke(PolicyImpl.java:95) at io.gravitee.gateway.policy.impl.PolicyImpl.onRequest(PolicyImpl.java:50) at io.gravitee.gateway.policy.impl.RequestPolicyChain.execute(RequestPolicyChain.java:45) at io.gravitee.gateway.policy.impl.PolicyChain.doNext(PolicyChain.java:72) at io.gravitee.gateway.policy.impl.StreamablePolicyChain.doNext(StreamablePolicyChain.java:54) at io.gravitee.gateway.policy.impl.PolicyChain.handle(PolicyChain.java:105) at io.gravitee.gateway.policy.impl.PolicyChain.handle(PolicyChain.java:42) at io.gravitee.gateway.core.processor.chain.AbstractStreamableProcessorChain.handle(AbstractStreamableProcessorChain.java:59) at io.gravitee.gateway.core.processor.chain.AbstractStreamableProcessorChain.lambda$handle$1(AbstractStreamableProcessorChain.java:55) at io.gravitee.gateway.policy.impl.PolicyChain.doNext(PolicyChain.java:89) at io.gravitee.gateway.policy.impl.PolicyChain.handle(PolicyChain.java:105) at io.gravitee.gateway.policy.impl.PolicyChain.handle(PolicyChain.java:42) at io.gravitee.gateway.core.processor.chain.AbstractStreamableProcessorChain.handle(AbstractStreamableProcessorChain.java:59) at io.gravitee.gateway.core.processor.chain.AbstractStreamableProcessorChain.lambda$handle$1(AbstractStreamableProcessorChain.java:55) at io.gravitee.gateway.policy.impl.PolicyChain.doNext(PolicyChain.java:89) at io.gravitee.gateway.policy.impl.StreamablePolicyChain.doNext(StreamablePolicyChain.java:54) at io.gravitee.policy.apikey.ApiKeyPolicy.onRequest(ApiKeyPolicy.java:95) at jdk.internal.reflect.GeneratedMethodAccessor326.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at io.gravitee.gateway.policy.impl.PolicyImpl.invoke(PolicyImpl.java:95) at io.gravitee.gateway.policy.impl.PolicyImpl.onRequest(PolicyImpl.java:50) at io.gravitee.gateway.policy.impl.RequestPolicyChain.execute(RequestPolicyChain.java:45) at io.gravitee.gateway.policy.impl.PolicyChain.doNext(PolicyChain.java:72) at io.gravitee.gateway.policy.impl.StreamablePolicyChain.doNext(StreamablePolicyChain.java:54) at io.gravitee.gateway.policy.impl.PolicyChain.handle(PolicyChain.java:105) at io.gravitee.gateway.policy.impl.PolicyChain.handle(PolicyChain.java:42) at io.gravitee.gateway.core.processor.chain.AbstractStreamableProcessorChain.handle(AbstractStreamableProcessorChain.java:59) at io.gravitee.gateway.handlers.api.ApiReactorHandler.handleClientRequest(ApiReactorHandler.java:104) at io.gravitee.gateway.handlers.api.ApiReactorHandler.doHandle(ApiReactorHandler.java:86) at io.gravitee.gateway.reactor.handler.AbstractReactorHandler.handle(AbstractReactorHandler.java:89) at io.gravitee.gateway.reactor.handler.AbstractReactorHandler.handle(AbstractReactorHandler.java:43) at io.gravitee.gateway.reactor.impl.DefaultReactor.lambda$route$2(DefaultReactor.java:100) at io.gravitee.gateway.core.processor.chain.AbstractProcessorChain.handle(AbstractProcessorChain.java:46) at io.gravitee.gateway.core.processor.chain.AbstractProcessorChain.lambda$handle$0(AbstractProcessorChain.java:41) at io.gravitee.gateway.reactor.processor.transaction.TransactionProcessor.handle(TransactionProcessor.java:55) at io.gravitee.gateway.reactor.processor.transaction.TransactionProcessor.handle(TransactionProcessor.java:29) at io.gravitee.gateway.core.processor.chain.AbstractProcessorChain.handle(AbstractProcessorChain.java:44) at io.gravitee.gateway.core.processor.chain.AbstractProcessorChain.lambda$handle$0(AbstractProcessorChain.java:41) at io.gravitee.gateway.reactor.processor.forward.XForwardForProcessor.handle(XForwardForProcessor.java:55) at io.gravitee.gateway.reactor.processor.forward.XForwardForProcessor.handle(XForwardForProcessor.java:30) at io.gravitee.gateway.core.processor.chain.AbstractProcessorChain.handle(AbstractProcessorChain.java:44) at io.gravitee.gateway.reactor.impl.DefaultReactor.route(DefaultReactor.java:107) at io.gravitee.gateway.standalone.vertx.VertxReactorHandler.route(VertxReactorHandler.java:48) at io.gravitee.gateway.standalone.vertx.VertxReactorHandler.handle(VertxReactorHandler.java:44) at io.gravitee.gateway.standalone.vertx.VertxReactorHandler.handle(VertxReactorHandler.java:29) at io.vertx.core.http.impl.WebSocketRequestHandler.handle(WebSocketRequestHandler.java:50) at io.vertx.core.http.impl.WebSocketRequestHandler.handle(WebSocketRequestHandler.java:32) at io.vertx.core.http.impl.HttpServerRequestImpl.handleBegin(HttpServerRequestImpl.java:149) at io.vertx.core.http.impl.Http1xServerConnection.handleMessage(Http1xServerConnection.java:132) at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:320) at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:43) at io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:188) at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:173) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:345) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:337) at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) at io.netty.handler.codec.http.websocketx.extensions.WebSocketServerExtensionHandler.channelRead(WebSocketServerExtensionHandler.java:102) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:345) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:337) at io.vertx.core.http.impl.Http1xUpgradeToH2CHandler.channelRead(Http1xUpgradeToH2CHandler.java:98) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:345) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:337) at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:345) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:337) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:323) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:297) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:345) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:337) at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1476) at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1225) at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1272) at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:502) at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:441) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:278) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:345) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:337) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1408) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:345) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:930) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:677) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:612) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:529) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:491) at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:905) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.net.URISyntaxException: Illegal character in path at index 76: https://localhost:8383/couchdb/maptiles/_design/maptiles/_rewrite/fonts/Noto Sans Regular/0-255.pbf at java.base/java.net.URI$Parser.fail(URI.java:2915) at java.base/java.net.URI$Parser.checkChars(URI.java:3086) at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3168) at java.base/java.net.URI$Parser.parse(URI.java:3116) at java.base/java.net.URI.(URI.java:600) at java.base/java.net.URI.create(URI.java:881) ... 108 more

Possible Solution

currentliy no possible solution

Steps to Reproduce (for bugs)

  1. The definition: maptiles-2-2-0.zip
  2. The request:
    Hide context
    Context
    Client id 4418db10-2b87-4fe1-8693-f0cc2c700685
    Application VOIS | Client
    Plan api key plan
    Endpoint
    Go to subscription
    Gateway
    Host M-SchuP01
    IP 192.168.81.237
    Request
    Date Nov 13, 2019 1:57:32.202 PM
    Host localhost:8082
    Request GET /maptiles/_design/maptiles-db/fonts/Noto%20Sans%20Regular/0-255.pbf
    Content-length 0
    Request ID 5b6ef26b-18c9-4d1b-aef2-6b18c93d1b6d
    Transaction ID 5b6ef26b-18c9-4d1b-aef2-6b18c93d1b6d
    Remote IP 127.0.0.1
    Response
    Status 400
    Global response time 1 ms
    API response time 1 ms
    Latency 0 ms
    Content-length 0

Context

The Api does not work as expected

Your Environment

  • Version used: 1.29.5
  • Browser Name and version: Chromium latest
  • Operating System and version: Windows 7, OpenJdk 11
@schulm

This comment has been minimized.

Copy link
Author

@schulm schulm commented Nov 13, 2019

Here is our temporarily fix for this issue: gravitee-io/gravitee-gateway#460

@schulm

This comment has been minimized.

Copy link
Author

@schulm schulm commented Nov 26, 2019

Hi, do you need more information?

@NicolasGeraud

This comment has been minimized.

Copy link
Member

@NicolasGeraud NicolasGeraud commented Nov 27, 2019

hi @schulm , I'm going to try thanks.

@NicolasGeraud

This comment has been minimized.

Copy link
Member

@NicolasGeraud NicolasGeraud commented Nov 27, 2019

ok so your hot fix is not good enough because you encode everything even if the original url is already encoded.

I'm going to refuse your pull request and add a new one. Thanks for having shared this, this has pointed an interesting issue.

@schulm

This comment has been minimized.

Copy link
Author

@schulm schulm commented Nov 27, 2019

@NicolasGeraud Thx, and sorry for the botched pr, forgot to disable the autoformatter ...

@schulm

This comment has been minimized.

Copy link
Author

@schulm schulm commented Nov 28, 2019

@NicolasGeraud
Hi, I applied the commit to 1.29.5, and Im getting an error that a URL is encoded multiple times:
the input url:

/housing/getApplicationHistoryByRegNr?startkey=[%22531245%22,%22香%22]&endkey=[%22531245%22,%22%22]&descending=true&include_docs=true

the url gets transformed to

https://localhost:8383/couchdb/housing/_design/housing/_rewrite/getApplicationHistoryByRegNr?startkey=[%2522531245%2522,%2522%5Cu9999%2522]&endkey=[%2522531245%2522,%2522%5Cu0000%2522]&descending=true&include_docs=true

image

NicolasGeraud added a commit to gravitee-io/gravitee-policy-dynamic-routing that referenced this issue Dec 3, 2019
@NicolasGeraud

This comment has been minimized.

Copy link
Member

@NicolasGeraud NicolasGeraud commented Dec 3, 2019

@schulm Indeed, the point is the problem comes from the policy itself.

can you try it ?

tcompiegne added a commit to gravitee-io/gravitee-policy-dynamic-routing that referenced this issue Dec 4, 2019
@tcompiegne tcompiegne closed this Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
API Management
Awaiting triage
3 participants
You can’t perform that action at this time.