Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mvcUrl is always rendering scheme+host+port, that should be optional only when absolute link is needed [SPR-13045] #17637

Closed
spring-issuemaster opened this issue May 19, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented May 19, 2015

Alex Panchenko opened SPR-13045 and commented


Affects: 4.1.6

Referenced from: commits ad4c879

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented May 19, 2015

Rossen Stoyanchev commented

You would like a relative link, or a context path relative link? Is it causing any issues?

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented May 19, 2015

Alex Panchenko commented

I would like to have a link with context path and without host name, similar to those produced by <c:url/> or spring:url/. That's perfectly enough, I think host name is needed only in some very rare cases.

There are 2 issues with having host name in links:

  • it could be that servlet container is not aware of the actual host name, e.g. if tomcat is put behind nginx
  • longer HTML
@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented May 20, 2015

Rossen Stoyanchev commented

Okay I see your point that we could switch to leaving out the scheme, host, and port and I'm not sure we want to go farther than that (e.g. provide other options) as mvcUrl is a simple function declaration. The functionality is really provided by the underlying MvcUriComponentsBuilder which got a number of improvements for 4.2 and is more flexible (#17218, #17397) and it's easy to bypass mvcUrl.

That said regarding tomcat behind nginx, that should still work. We detect x-forwarded headers. Have you had issues or is this hypothetical?

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented May 20, 2015

Alex Panchenko commented

On tomcat+nginx: in some of our applications tomcat is aware only of its internal host name and it is not supposed to expose it in HTML. Definitely I would have issues if using this function. Surely it can be configured to pass the original host name, etc., but that's not necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.