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

30th
Jul 2015
ccit-spence
@ccit-spence
Jul 30 2015 05:39
@dsyer Finally working on the 302 problem I am having. It appears to be coming from Spring MVC. Looks like to change default behavior you must use this setUseTrailingSlashMatch(false). What I don’t understand is how this could be working for others if this is built into Spring MVC as a default to do a redirect.
ccit-spence
@ccit-spence
Jul 30 2015 05:44
When Spring MVC gets a url request for http://domain/something it will redirect to http://domain/something/ Not sure which but either Zuul or Ribbon will return the direct link of the UI service in the case of the http://domain/something sending me to http://directhost:8080/something/
Dave Syer
@dsyer
Jul 30 2015 06:04
It's nothing to do with Zuul or ribbon
It's the backend sending a redirect to itself
ccit-spence
@ccit-spence
Jul 30 2015 06:06
I understand the reason why it would happen. From an seo perspective you get 2 urls for the same page.
it makes the app essnetially crash for users anytime they manually don’t add a slash
Dave Syer
@dsyer
Jul 30 2015 06:07
I know
Seems like it's a bug in Spring to me
I had suspected tomcat
ccit-spence
@ccit-spence
Jul 30 2015 06:09
I did put this in a config
@Override public void configurePathMatch(PathMatchConfigurer configurer) { configurer .setUseTrailingSlashMatch(false); }
did not change the behavior
Dave Syer
@dsyer
Jul 30 2015 06:09
Then what makes you think it's Spring MVC?
I'm confused again
ccit-spence
@ccit-spence
Jul 30 2015 06:10
it adds a slash going directly to the spring mvc app
bypassing zuul
the setting above did not change the behavior
Dave Syer
@dsyer
Jul 30 2015 06:11
What is your MVC @RequestMapping for the home page?
ccit-spence
@ccit-spence
Jul 30 2015 06:12
I have tried @RequestMapping("/*”) and @RequestMapping("/")
Dave Syer
@dsyer
Jul 30 2015 06:12
Don't you need {"","/"} ?
ccit-spence
@ccit-spence
Jul 30 2015 06:16
no change
@RequestMapping({“ ","/"})
Dave Syer
@dsyer
Jul 30 2015 06:17
can you modify the "double" sample to behave like your app?
ccit-spence
@ccit-spence
Jul 30 2015 06:18
I can put it together real quick
Dave Syer
@dsyer
Jul 30 2015 06:21
Send a PR
ccit-spence
@ccit-spence
Jul 30 2015 07:23
just sent the PR
I actuaslly just added a project within the double. It is very simple but will produce the 302
Dave Syer
@dsyer
Jul 30 2015 07:26
OK I'll take a look
I doubt you're the first person to put a spring MVC app behind a proxy
So there must be something else to it
ccit-spence
@ccit-spence
Jul 30 2015 07:27
I agree
I hope
this version is dead simple and still redirects
ccit-spence
@ccit-spence
Jul 30 2015 07:41
I did just update Zuul in the double if you want me to commit that. It now replicates the exact problem I am seeing
Dave Syer
@dsyer
Jul 30 2015 07:42
Just add it to the PR?
ccit-spence
@ccit-spence
Jul 30 2015 07:42
ok, my redis is in docker, so that will need to be updated
Dave Syer
@dsyer
Jul 30 2015 07:42
?
You use a different host?
boot2docker?
ccit-spence
@ccit-spence
Jul 30 2015 07:43
since the gateway has redis up. I don’t have a local redis I had to change the yml to point to my docker instance
yes boot2docker
Dave Syer
@dsyer
Jul 30 2015 07:43
It's a scourge
ccit-spence
@ccit-spence
Jul 30 2015 07:43
I agree
Dave Syer
@dsyer
Jul 30 2015 07:44
OK. Can you send a new commit?
ccit-spence
@ccit-spence
Jul 30 2015 07:44
sure
Dave Syer
@dsyer
Jul 30 2015 07:44
Why doesn't boot2docker ship with a TCP proxy?
It would make everyone's life a lot easier
ccit-spence
@ccit-spence
Jul 30 2015 07:45
the isolation technically is nice, still a pain though
did the new commit work?
Dave Syer
@dsyer
Jul 30 2015 07:47
I'm trying it now
Still starting Eclipse
Dave Syer
@dsyer
Jul 30 2015 07:58
That 302 is coming from Tomcat
which is what I said 2 days ago
I'm pretty sure about that - look at the headers
There's no sign it got to Spring MVC
I'll check though
ccit-spence
@ccit-spence
Jul 30 2015 08:00
I do see what you mean
would that be from the initiator “other” in chrome dev tools
Dave Syer
@dsyer
Jul 30 2015 08:04
"other" is the browser probably
Or maybe the proxy
if you are testing that
You can get a 302 just by hitting the home page in localhost:8085/ui/test
ccit-spence
@ccit-spence
Jul 30 2015 08:05
yes, that is what I was seeing as well
Dave Syer
@dsyer
Jul 30 2015 08:06
I have a workaround
change your contextPath to "/ui" and your @RequestMapping to {"/test","/test/"}
I doubt if there is anything you can do to stop Tomcat sending a 302
We could ask them to use the proxy headers if available
ccit-spence
@ccit-spence
Jul 30 2015 08:08
the only problem is if you have ui/service1, ui/service2 etcs
Dave Syer
@dsyer
Jul 30 2015 08:09
How is that a problem?
ccit-spence
@ccit-spence
Jul 30 2015 08:09
I guess it wouldn’t be now that I look at the statement
Dave Syer
@dsyer
Jul 30 2015 08:09
They all had to have a context path. It's just moving the config around.
You can use placeholders in @RequestMapping as well if you want to put it all in YAML
ccit-spence
@ccit-spence
Jul 30 2015 08:10
and zuul has no knowledge of indiviual context paths
Dave Syer
@dsyer
Jul 30 2015 08:10
Zuul doesn't know the difference between a context path and a servlet path
It's just a URL for him
ccit-spence
@ccit-spence
Jul 30 2015 08:11
so that does work
the logic being since it is the context path tomcat jumps in
not real clear on why “”, “/“ is not the same thing
ccit-spence
@ccit-spence
Jul 30 2015 08:18
just figured out another fix
server.servlet-path= /*
Dave Syer
@dsyer
Jul 30 2015 08:19
That might break other things
But if it works for you that's good
ccit-spence
@ccit-spence
Jul 30 2015 08:19
I did test it in the test app
granted it doesn’t really do anything
Dave Syer
@dsyer
Jul 30 2015 08:20
It changes the servlet path
ccit-spence
@ccit-spence
Jul 30 2015 08:20
bottom line, thanks for the help in finding it
Dave Syer
@dsyer
Jul 30 2015 08:20
So it does something
Can you comment back on that spring cloud issue?
ccit-spence
@ccit-spence
Jul 30 2015 08:20
I meant the test app doesn’t do anything
Dave Syer
@dsyer
Jul 30 2015 08:20
Right
ccit-spence
@ccit-spence
Jul 30 2015 08:20
sure I can post to the issuer
issue, this thing need spelling correction
Dave Syer
@dsyer
Jul 30 2015 08:21
You can edit messages
It osla allows s/foo/bar/
ccit-spence
@ccit-spence
Jul 30 2015 08:21
same as hipchat then
Dave Syer
@dsyer
Jul 30 2015 08:22
Hipchat sucks more
ccit-spence
@ccit-spence
Jul 30 2015 08:22
yes, it does
Dave Syer
@dsyer
Jul 30 2015 08:22
and AFAIK you can't edit posts in the web UI
ccit-spence
@ccit-spence
Jul 30 2015 08:23
I should look at what I type before hitting enter more often
well, thanks again for the help. Now I have to try to get everything online. Building one smallish Spring Cloud app and one very large Spring Cloud app
Dave Syer
@dsyer
Jul 30 2015 08:24
Cool
When does it go live?
ccit-spence
@ccit-spence
Jul 30 2015 08:25
hoping within a couple of months
built a lot of automation stuff for management and deployment. that took a little time