diff options
| author | Melonai <einebeere@gmail.com> | 2021-09-10 23:40:49 +0200 |
|---|---|---|
| committer | Melonai <einebeere@gmail.com> | 2021-09-10 23:43:57 +0200 |
| commit | a32b9fe723c633cf5349bb0479d97e1f6d04445d (patch) | |
| tree | f45869da615f5efcd0b2dd8d1baade6831dd3f4f /handlers/passthrough.go | |
| parent | 175da8f22cd791e81338fe61e6099125868cf5a0 (diff) | |
| download | portgate-a32b9fe723c633cf5349bb0479d97e1f6d04445d.tar.zst portgate-a32b9fe723c633cf5349bb0479d97e1f6d04445d.zip | |
Refactor path into destination
Diffstat (limited to 'handlers/passthrough.go')
| -rw-r--r-- | handlers/passthrough.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/handlers/passthrough.go b/handlers/passthrough.go index 3f8aafc..30cc7df 100644 --- a/handlers/passthrough.go +++ b/handlers/passthrough.go @@ -9,7 +9,7 @@ import ( // handlePassthroughRequest handles requests which are supposed to be proxied to the destination host. // If the user is authorized they are allowed to pass, otherwise they should be redirected to // the authentication page. (/_portgate) -func (h *RequestHandler) handlePassthroughRequest(ctx *fasthttp.RequestCtx, p portgate.Path) { +func (h *RequestHandler) handlePassthroughRequest(ctx *fasthttp.RequestCtx, p portgate.Destination) { // TODO: Check whether port is allowed to be accessed. // Check whether given cookie is ok, if not redirect to the authentication page. @@ -21,7 +21,7 @@ func (h *RequestHandler) handlePassthroughRequest(ctx *fasthttp.RequestCtx, p po // We reuse the request given to us by the user with minor changes to route it to the // destination host. ctx.Request.SetRequestURI(h.config.MakeUrl(p)) - ctx.Request.Header.SetHost(h.config.TargetAddress(p.DestinationIdentifier)) + ctx.Request.Header.SetHost(h.config.TargetAddress(p.Port)) // We pipe the response given to us by the destination host back to the user. // Since it's possible that we get a redirect, we take this into account, |
