proxyee icon indicating copy to clipboard operation
proxyee copied to clipboard

想实现黑白名单,过滤请求方式以及域名的访问

Open q594054294 opened this issue 4 years ago • 2 comments

实现了HttpProxyAcceptHandler,但是发现只会拦截CONNECT的请求方式,现在想拦截GET,POST等等

` private static final String RESPONE = "<!DOCTYPE html><html><body><p>{}</p></body></html>";

String body = StrFormatter.format(HttpProxyServer.RESPONE, "不支持" + method + "请求方式"); response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.METHOD_NOT_ALLOWED); response.headers().set(HttpHeaderNames.CONTENT_TYPE,"text/html"); response.headers().set(HttpHeaderNames.CONTENT_LENGTH,body.length()); response.content().writeBytes(body.getBytes(StandardCharsets.UTF_8)); clientChannel.writeAndFlush(response); clientChannel.writeAndFlush(content); `

使用curl请求,发现无法解析返回的数据,大佬们可以给点建议么?

q594054294 avatar Sep 22 '21 07:09 q594054294

使用的onAccept(HttpRequest request, Channel clientChannel)方法

q594054294 avatar Sep 22 '21 07:09 q594054294

你是不是没开https拦截

monkeyWie avatar Sep 24 '21 01:09 monkeyWie