Skip to content

Commit 61f54cc

Browse files
committed
-
1 parent d5dce6d commit 61f54cc

File tree

5 files changed

+22
-30
lines changed

5 files changed

+22
-30
lines changed

CHANGES

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
1.0.1
2-
- some minor bugs corrections
3-
1+
1.0.0
2+
- initial release
43
2.0.0
54
- code rewritten
6-
- https server added
5+
- https server added
6+
2.0.1
7+
- make headers optional in Register function
8+
- some small corrections in documentation

README.md

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
reverseproxy
22
====
3-
[![version](https://img.shields.io/badge/version-2.0.0-blue.svg)](https://github.com/geosoft1/reverseproxy/archive/master.zip)
3+
[![version](https://img.shields.io/badge/version-2.0.1-blue.svg)](https://github.com/geosoft1/reverseproxy/archive/master.zip)
44
[![license](https://img.shields.io/badge/license-gpl-blue.svg)](https://github.com/geosoft1/reverseproxy/blob/master/LICENSE)
55

66
Simple [reverse proxy](https://en.wikipedia.org/wiki/Reverse_proxy) server. Useful for accessing web applications on various servers (or VMs) through a single domain.
@@ -37,27 +37,17 @@ or for HTTPS
3737

3838
go build https.go
3939

40-
### Parameters
40+
Note that `Register` function (see [main.go](https://github.com/geosoft1/reverseproxy/blob/d5dce6d78fb666405cead40cf0c14fb7278f620a/main.go#L48), [http.go](https://github.com/geosoft1/reverseproxy/blob/d5dce6d78fb666405cead40cf0c14fb7278f620a/http.go#L47) and [https.go](https://github.com/geosoft1/reverseproxy/blob/d5dce6d78fb666405cead40cf0c14fb7278f620a/https.go#L48)) have some headers commented. Change as you wish for dealing with applications which need [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing).
4141

42-
#### `-conf`
42+
## Parameters
4343

44-
Start program with a certain configuration file. Default `conf.json`.
45-
46-
#### `-http`
47-
48-
Listening address and port for HTTP server. Default `:8080`.
49-
50-
#### `-https`
51-
52-
Listening address and port for HTTPS server. Default `:8090`.
53-
54-
#### `-https-enabled`
55-
56-
Enable HTTPS server. Default `false`.
57-
58-
#### `-verbose`
59-
60-
Enable verbose mode for middleware.
44+
Name|Description
45+
---|---
46+
`-conf`|Cache file name, default value `cache.json`.
47+
`-http`|Listening address and port for HTTP server, default value `8080`.
48+
`-https`|Listening address and port for HTTPS server, default value `8090`.
49+
`-https-enabled`|Enable HTTPS server. Default `false`.
50+
`-verbose`|Enable verbose mode for middleware.
6151

6252
## Routes
6353

http.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ func Register(p *httputil.ReverseProxy) func(http.ResponseWriter, *http.Request)
4949
if *verbose {
5050
log.Printf("request %s%s", r.RemoteAddr, r.RequestURI)
5151
}
52-
w.Header().Set("Access-Control-Allow-Origin", "*")
53-
w.Header().Set("Access-Control-Allow-Headers", "X-Requested-With")
52+
// w.Header().Set("Access-Control-Allow-Origin", "*")
53+
// w.Header().Set("Access-Control-Allow-Headers", "X-Requested-With")
5454
p.ServeHTTP(w, r)
5555
}
5656
}

https.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ func Register(p *httputil.ReverseProxy) func(http.ResponseWriter, *http.Request)
5050
if *verbose {
5151
log.Printf("request %s%s", r.RemoteAddr, r.RequestURI)
5252
}
53-
w.Header().Set("Access-Control-Allow-Origin", "*")
54-
w.Header().Set("Access-Control-Allow-Headers", "X-Requested-With")
53+
// w.Header().Set("Access-Control-Allow-Origin", "*")
54+
// w.Header().Set("Access-Control-Allow-Headers", "X-Requested-With")
5555
p.ServeHTTP(w, r)
5656
}
5757
}

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ func Register(p *httputil.ReverseProxy) func(http.ResponseWriter, *http.Request)
5050
if *verbose {
5151
log.Printf("request %s%s", r.RemoteAddr, r.RequestURI)
5252
}
53-
w.Header().Set("Access-Control-Allow-Origin", "*")
54-
w.Header().Set("Access-Control-Allow-Headers", "X-Requested-With")
53+
// w.Header().Set("Access-Control-Allow-Origin", "*")
54+
// w.Header().Set("Access-Control-Allow-Headers", "X-Requested-With")
5555
p.ServeHTTP(w, r)
5656
}
5757
}

0 commit comments

Comments
 (0)