Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
geosoft1 committed Dec 15, 2019
1 parent d5dce6d commit 61f54cc
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 30 deletions.
10 changes: 6 additions & 4 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
1.0.1
- some minor bugs corrections

1.0.0
- initial release
2.0.0
- code rewritten
- https server added
- https server added
2.0.1
- make headers optional in Register function
- some small corrections in documentation
30 changes: 10 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
reverseproxy
====
[![version](https://img.shields.io/badge/version-2.0.0-blue.svg)](https://github.com/geosoft1/reverseproxy/archive/master.zip)
[![version](https://img.shields.io/badge/version-2.0.1-blue.svg)](https://github.com/geosoft1/reverseproxy/archive/master.zip)
[![license](https://img.shields.io/badge/license-gpl-blue.svg)](https://github.com/geosoft1/reverseproxy/blob/master/LICENSE)

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.
Expand Down Expand Up @@ -37,27 +37,17 @@ or for HTTPS

go build https.go

### Parameters
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).

#### `-conf`
## Parameters

Start program with a certain configuration file. Default `conf.json`.

#### `-http`

Listening address and port for HTTP server. Default `:8080`.

#### `-https`

Listening address and port for HTTPS server. Default `:8090`.

#### `-https-enabled`

Enable HTTPS server. Default `false`.

#### `-verbose`

Enable verbose mode for middleware.
Name|Description
---|---
`-conf`|Cache file name, default value `cache.json`.
`-http`|Listening address and port for HTTP server, default value `8080`.
`-https`|Listening address and port for HTTPS server, default value `8090`.
`-https-enabled`|Enable HTTPS server. Default `false`.
`-verbose`|Enable verbose mode for middleware.

## Routes

Expand Down
4 changes: 2 additions & 2 deletions http.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ func Register(p *httputil.ReverseProxy) func(http.ResponseWriter, *http.Request)
if *verbose {
log.Printf("request %s%s", r.RemoteAddr, r.RequestURI)
}
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Headers", "X-Requested-With")
// w.Header().Set("Access-Control-Allow-Origin", "*")
// w.Header().Set("Access-Control-Allow-Headers", "X-Requested-With")
p.ServeHTTP(w, r)
}
}
Expand Down
4 changes: 2 additions & 2 deletions https.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ func Register(p *httputil.ReverseProxy) func(http.ResponseWriter, *http.Request)
if *verbose {
log.Printf("request %s%s", r.RemoteAddr, r.RequestURI)
}
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Headers", "X-Requested-With")
// w.Header().Set("Access-Control-Allow-Origin", "*")
// w.Header().Set("Access-Control-Allow-Headers", "X-Requested-With")
p.ServeHTTP(w, r)
}
}
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ func Register(p *httputil.ReverseProxy) func(http.ResponseWriter, *http.Request)
if *verbose {
log.Printf("request %s%s", r.RemoteAddr, r.RequestURI)
}
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Headers", "X-Requested-With")
// w.Header().Set("Access-Control-Allow-Origin", "*")
// w.Header().Set("Access-Control-Allow-Headers", "X-Requested-With")
p.ServeHTTP(w, r)
}
}
Expand Down

0 comments on commit 61f54cc

Please sign in to comment.