File tree Expand file tree Collapse file tree 4 files changed +25
-8
lines changed
Expand file tree Collapse file tree 4 files changed +25
-8
lines changed Original file line number Diff line number Diff line change @@ -34,4 +34,5 @@ package
3434
3535local_dist.ps1
3636bak
37- docker /local_build.ps1
37+ docker /local_build.ps1
38+ src /main /resources /private.conf
Original file line number Diff line number Diff line change @@ -15,9 +15,25 @@ If you want to get all requests and responses about `https://www.exmample.com (1
15152 . run commands below:
1616``` shell
1717# run with sbt
18-
1918sbt " runMain Main --dns=192.168.3.3:www.example.com --jks-path=jks.jks --jks-password=123456 --websocketPort=9000"
20- # open your browser to access http://127.0.0.1:9000/viewer
19+
20+
21+ # run with docker
22+ # config file would be:
23+
24+ # jks {
25+ # path=/server/config/jks.jks
26+ # password=123456
27+ # }
28+ # resolver=[114.114.114.114]
29+ # viewerPort=9000
30+ # ##selfSignedCert = "" # if you use self signed cert.
31+
32+ docker run --rm -v ${pwd} /private.conf:/server/config/application.conf -v${pwd} /jks.jks:/server/config/jks.jks -p 443:443 -p 9000:9000 ghcr.io/timzaak/log-http-proxy:latest
33+
34+
35+ # open your browser to access http://127.0.0.1:9000
36+
2137```
2238The params are:
2339
Original file line number Diff line number Diff line change @@ -71,8 +71,8 @@ object Main {
7171 val bindAndCheck = proxy.startServer()
7272 Await .result(
7373 bindAndCheck.flatMap { v =>
74- val changedHosts = dnsPairs. map((domain, _) => s " 127.0.0.1 $domain" ).mkString(" \n " )
75- val buf = StringBuffer (" proxy server is up, listening 443 port.\n " )
74+ val changedHosts = config.dns. map( v => s " 127.0.0.1 ${v. domain} " ).mkString(" \n " )
75+ val buf = StringBuffer (s " proxy server is up, listening ${v.localAddress.getPort} port. \n " )
7676 if (changedHosts.nonEmpty) {
7777 buf.append(s " additional host config: \n $changedHosts\n " )
7878 }
Original file line number Diff line number Diff line change @@ -42,10 +42,10 @@ case class Record2(
4242 } else {
4343 buf.append(s " ContentType: ${req.entity.contentType}\n Body: \n " )
4444 }
45-
45+
4646
4747 req.method match {
48- case v if v != HttpMethods .GET || v!= HttpMethods .OPTIONS =>
48+ case v if v != HttpMethods .GET && v!= HttpMethods .OPTIONS =>
4949 req.entity.contentType.mediaType match {
5050 case mediaType if mediaType.isMultipart =>
5151 Option (mediaType.getParams.get(" boundary" )) match {
@@ -68,7 +68,7 @@ case class Record2(
6868 }
6969
7070 case mediaType
71- if mediaType.isText || mediaType.isApplication || mediaType.isMessage || mediaType.isMultipart =>
71+ if mediaType.isText || mediaType.isApplication || mediaType.isMessage || req.entity.contentLengthOption.getOrElse( 0 ) == 0 =>
7272 req.withEntity(
7373 req.entity.transformDataBytes(
7474 Flow [ByteString ].alsoTo(
You can’t perform that action at this time.
0 commit comments