These are chat archives for spring-cloud/spring-cloud

9th
Jun 2016
Dave Syer
@dsyer
Jun 09 2016 06:06 UTC
Can't you use ribbon.S1.serverList to redirect the load balancer?
Ah, right. You can't do that.
Would be a useful feature
Spencer Gibb
@spencergibb
Jun 09 2016 06:08 UTC
Yeah, Netflix has requested it
Dave Syer
@dsyer
Jun 09 2016 06:09 UTC
I always thought we should have more flexibility with the discovery client
If there was a CompositeDiscoveryClient and it looked "locally" before going to Eureka that would work too
Spencer Gibb
@spencergibb
Jun 09 2016 06:11 UTC
Netflix requested that their configuration properties where they specify class names is honored
For server list, ping etc
Dave Syer
@dsyer
Jun 09 2016 06:12 UTC
Ugh
Hack your way out
Daco
@dacofr
Jun 09 2016 07:56 UTC
I found, a little workaround by adding this in my feign client interface
@FeignClient(name = "foo", url = "${foo.ribbon.listOfServers:}")
the last semi colon is just for having a default value and do not declare it in my application.properties
Dave Syer
@dsyer
Jun 09 2016 07:57 UTC
If that works, you don't need "ribbon.listOfServers" (it's unrelated to ribbon at that point I think)
Michael Rumpf
@mrumpf
Jun 09 2016 12:51 UTC
@dsyer The fix you suggested (spring-cloud/spring-cloud-commons@ff59dc8) for the spring-cloud-commons works for us! Thx. One more question: how long does it take to sync the 1.1.1.RELEASE to Maven Central?
Dave Syer
@dsyer
Jun 09 2016 12:58 UTC
A couple of hours once we pull the trigger (that hasn't happened yet)
Michael Rumpf
@mrumpf
Jun 09 2016 13:12 UTC
ok, so you are not releasing spring-cloud-commons 1.1.1.RELEASE independently, it is part of the full Spring Cloud 1.1.1.RELEASE.
Dave Syer
@dsyer
Jun 09 2016 13:45 UTC
It's independent in principle
We just haven't pulled the trigger
Most people consume it through the Brixton release train (it's not 1.1.1)
Ali Akbar Azizkhani
@removed~azizkhani
Jun 09 2016 16:29 UTC
What is equivalent nginx sub_filter in zuul
Spencer Gibb
@spencergibb
Jun 09 2016 16:31 UTC
I don’t know what that is, so I can’t say.
Ali Akbar Azizkhani
@removed~azizkhani
Jun 09 2016 16:32 UTC
Sub_filter replace content fo example when url in app back off proxy will change
Sub filter can change url from local to
Spencer Gibb
@spencergibb
Jun 09 2016 16:32 UTC
there are no built in filters that modify response content.
Ali Akbar Azizkhani
@removed~azizkhani
Jun 09 2016 16:33 UTC
How can i do it
Spencer Gibb
@spencergibb
Jun 09 2016 16:33 UTC
you would need to write your own filter
Ali Akbar Azizkhani
@removed~azizkhani
Jun 09 2016 16:34 UTC
Url in behind off proxy is /app but in proxy /anotherapp
I want to change url that in resources like jsp that generate using tag <c:url
I read
Document in spring boot that say x-forward-for
Can make that
Is that ok?
Spencer Gibb
@spencergibb
Jun 09 2016 16:38 UTC
zuul sends proxy headers, but no filters rewrite responses. Downstream apps have to take advantage of the headers.
Ali Akbar Azizkhani
@removed~azizkhani
Jun 09 2016 16:42 UTC
@dsyer what is x-forward-for ? Is that change url that generate in behind of proxy ? I see this configuration in spring boot i think that mybe relate to zuul
Ali Akbar Azizkhani
@removed~azizkhani
Jun 09 2016 16:54 UTC
@dsyer yes i read that .is that solution for my problem
?
Dave Syer
@dsyer
Jun 09 2016 16:57 UTC
It depends on what the problem is.
If your problem is rendering links in the backend services. Then probably.
it depends who is rendering them
Ali Akbar Azizkhani
@removed~azizkhani
Jun 09 2016 16:57 UTC
I have app in behind of proxy that have context path like this localhost/app
But in front of proxy i map /anotherapp to that
Url that generate using <c:url tag
Create /app
But i want to create /anotherapp
Dave Syer
@dsyer
Jun 09 2016 16:59 UTC
JSP tags should use the HttpServletRequest to render links.
So it knows about hosts, ports and protocols probably
But not context paths
Ali Akbar Azizkhani
@removed~azizkhani
Jun 09 2016 17:00 UTC
My url
<c:url value="/user/1"/>
Content behind of proxy is /app/user/1
But i want render
/anotherapp/user/1
Dave Syer
@dsyer
Jun 09 2016 17:03 UTC
I guess you have to put in your own Filter to wrap the request then
No-one can guess that
David Welch
@dwelch2344
Jun 09 2016 17:03 UTC
another option (if I understand)
you using embedded tomcat?
Ali Akbar Azizkhani
@removed~azizkhani
Jun 09 2016 17:04 UTC
Somtime yes but some production env weblogic
Dave Syer
@dsyer
Jun 09 2016 17:04 UTC
There is one in Spring 4.3 I think
David Welch
@dwelch2344
Jun 09 2016 17:04 UTC
ah nvm. filters def best bet
Dave Syer
@dsyer
Jun 09 2016 17:04 UTC
But it's easy to write your own
David Welch
@dwelch2344
Jun 09 2016 17:05 UTC
yup
Ali Akbar Azizkhani
@removed~azizkhani
Jun 09 2016 17:05 UTC
I can not change code because i have more than 1000 form
Jsp code
Dave Syer
@dsyer
Jun 09 2016 17:05 UTC
You can write a filter
Ali Akbar Azizkhani
@removed~azizkhani
Jun 09 2016 17:06 UTC
Filter for change content or change context path
?
Dave Syer
@dsyer
Jun 09 2016 17:06 UTC
Change the url path
Everything that renders links in a servlet app is using the HttpServletRequest
Ali Akbar Azizkhani
@removed~azizkhani
Jun 09 2016 17:07 UTC
How can do it ?
Dave Syer
@dsyer
Jun 09 2016 17:07 UTC
You can wrap it in Filter
Ali Akbar Azizkhani
@removed~azizkhani
Jun 09 2016 17:07 UTC
And use x-forward-for
For get front of proxy path?
Dave Syer
@dsyer
Jun 09 2016 17:08 UTC
Yes
Or you can use that filter (Spring 4.3) and just ask your proxy to set X-Forwarded-Prefix(zuul does that if you ask it as well)
Ali Akbar Azizkhani
@removed~azizkhani
Jun 09 2016 17:10 UTC
Yes i can set in proxy
If i understand .spring 4.3 add this feature ?
David Welch
@dwelch2344
Jun 09 2016 17:15 UTC

So, looking for a solution to a situation in our spring cloud + spring security app. Whether or not a user is logged in (e.g. anonymous), we need to know the region and locale for a user in each of our microservices. Easy enough to store in a cookie, but once we pass Zuul our microservices don't have access to cookies.

Now, we were thinking we could have Zuul translate it from a cookie to a header, but then we'd need to forward all those headers across our feign clients as well (not a ton of work, but feels hacky)

An alternative approach we came up with is to track the locale and region on the JWT token we pass with each request (since it's already wired up) – which works great. Our only problem with this approach is the anonymous user bit.

@dsyer - can you think of an easy way to "enhance" the concept of an anonymous user to track these details? Or is it best just to pass the bread crumbs along (and utilize LocaleContextHolder – and possibly create a RegionContextHolder)

Dave Syer
@dsyer
Jun 09 2016 17:22 UTC
Where does the information come from?
If it's an anonymous user how can you know their location
David Welch
@dwelch2344
Jun 09 2016 17:40 UTC
client side. we infer based of browser details / geo-location, but give them the ability to manually specify it
we could do it server side I guess, but in the end the ability for a user to specify /override is a requirement
Dave Syer
@dsyer
Jun 09 2016 17:47 UTC
If you've got logic for that in the client can't you just turn it into headers that get propagated all the way to the backend?
David Welch
@dwelch2344
Jun 09 2016 20:04 UTC
yeah, was trying to cook up something a bit more elegant since it has to be carried over in about 3 places, but I think it's actually not so bad
just figured I'd throw the idea out to see if someone had solved this kinda thing already
thx
ccit-spence
@ccit-spence
Jun 09 2016 21:02 UTC
Does it make any difference if you use OpenJDK 8 vs Oracle Java 8 with JCE. From my understanding JCE is bundled with OpenJDK and much easier to work with within Docker. Are there any known gotchas with Spring Cloud and OpenJDK?
Dave Syer
@dsyer
Jun 09 2016 21:05 UTC
AFAIK JCE is not bundled with any jdk
But open jdk works fine with all spring cloud apps I ever tried apart from that
Maybe something changed recently though because cloud foundry Java build pack has JCE in it now, and it didn't use to
ccit-spence
@ccit-spence
Jun 09 2016 21:15 UTC
from what I understand t is included. I am just trying to be lazy and not have to build Docker files that accepts Oracle's license. You end up having to maintain tags for each time they update.
ccit-spence
@ccit-spence
Jun 09 2016 21:35 UTC
@dsyer are you planning to port your Angular security stuff to Angular2?