小编bin*_*rek的帖子

一个带有 Apache Camel 的简单 HTTPS 代理服务器

我正在尝试使用 Apache Camel 实现一个简单的 HTTP 代理服务。我的代码如下所示:

from("jetty:http://localhost:80?matchOnUriPrefix=true")
.recipientList(simple("jetty:${in.header.CamelHttpUrl}?bridgeEndpoint=true&throwExceptionOnFailure=false&disableStreamCache=true"));
Run Code Online (Sandbox Code Playgroud)

它本质上是这样一个动态收件人列表,以支持多个目的地。我还必须添加该disableStreamCache=true位,否则我会得到路径重复的奇怪异常(就像/index.html会变成/index.html/index.html)。

尽管如此,它似乎有效。但仅限于 HTTP 请求。当我尝试访问 HTTPS 站点时,总是收到 404。

根据日志,jetty 组件似乎没有找到远程服务器。我不知道为什么。

01:36:37.495 [qtp85415531-22 - www.google.cz:443] DEBUG org.eclipse.jetty.server.Server - REQUEST www.google.cz:443 on AsyncHttpConnection@6964b063,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=-5,l=17,c=0},r=1
01:36:37.495 [qtp85415531-22 - www.google.cz:443] DEBUG o.e.j.server.handler.ContextHandler - scope null||www.google.cz:443 @ o.e.j.s.ServletContextHandler{/,null}
01:36:37.495 [qtp85415531-22 - www.google.cz:443] DEBUG o.e.j.server.handler.ContextHandler - context=null||www.google.cz:443 @ o.e.j.s.ServletContextHandler{/,null}
01:36:37.495 [qtp85415531-22 - www.google.cz:443] DEBUG o.e.jetty.servlet.ServletHandler - servlet null||www.google.cz:443 -> null
01:36:37.495 [qtp85415531-22 - www.google.cz:443] DEBUG o.e.jetty.servlet.ServletHandler - chain=null
01:36:37.495 [qtp85415531-22 - www.google.cz:443] …
Run Code Online (Sandbox Code Playgroud)

java https apache-camel http-proxy

2
推荐指数
1
解决办法
5372
查看次数

标签 统计

apache-camel ×1

http-proxy ×1

https ×1

java ×1