I have a problem in reverse proxy using zuul.
My app has a downstream service that used spring security for authentication. This project redirects to login.jsp when user requests Index.jsp.
My zuul configuration in zuul project is this:
zuul:
#addProxyHeaders : true
#ignoreSecurityHeaders: false
routes:
trp:
path: /app/**
url: http://192.168.251.141:5050/app
server:
port: 80
But when a user calls http://localhost/app/Index.jsp application redirect to http://192.168.251.141:5050/app/Login.jsp
After googling that I found response is like this:
Content-Encoding gzip
Content-Type text/html
Date Mon, 26 Dec 2016 09:02:44 GMT
Location http://192.168.251.141:5050/app/Login.jsp
Transfer-Encoding chunkedVary
Accept-Encoding
X-Application-Context application:80
X-Content-Type-Options nosniff
X-Frame-Options SAMEORIGIN
X-XSS-Protection 1; mode=block
Why is the Location
header http://192.168.251.141:5050/app/Login.jsp? And why doesn't Zuul change this ip?
This configuration works in nginx by using the proxy_redirect
module. How can change location by zuul routes?
Zuul doesn't rewrite any responses by default. Your downstream service would have to know how to deal with the
X-Forwarded-Host
header that zuul adds and redirect there. Another option would be to write a zuul filter that rewrites the Location header.