Skip to content

Commit

Permalink
Getting feet wet, added origin host header for sites which require it…
Browse files Browse the repository at this point in the history
… match the site name
  • Loading branch information
Clayton Han-Mitchell committed Apr 3, 2015
1 parent 9224295 commit 3057f90
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ class PreDecorationFilter extends ZuulFilter {
// sets origin
ctx.setRouteHost(new URL("http://apache.org/"));

// set origin host header
ctx.addZuulRequestHeader("Host","apache.org");

// sets custom header to send to the origin
ctx.addOriginResponseHeader("cache-control", "max-age=3600");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ class SimpleHostRoutingFilter extends ZuulFilter {

boolean isValidHeader(String name) {
if (name.toLowerCase().contains("content-length")) return false;
if (name.toLowerCase().equals("host")) return false; // set host according to origin vhost
if (!RequestContext.currentContext.responseGZipped) {
if (name.toLowerCase().contains("accept-encoding")) return false;
}
Expand Down

0 comments on commit 3057f90

Please sign in to comment.