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

Consider enhancing ResourceUrlProvider to be able to change the domain, port, or scheme [SPR-12130] #16746

Closed
spring-projects-issues opened this issue Aug 28, 2014 · 4 comments
Assignees
Labels
in: web status: duplicate type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Aug 28, 2014

Brian Clozel opened SPR-12130 and commented

Now that the new
resource handling feature is in release candidate phase, we received feedback on several aspects.

One of those feedbacks is about changing the HTTP domain that serves resources. Here are some use cases for this:

  • use of a 3rd party CDN on a separate domain (like Amazon cloudfront)
  • use of a separate, cookie-less domain for better web performance, since sending cookies with each request can be a performance issue

See this Twitter conversation (in french) for reference.

We considered allowing ResourceResolvers to return complete URLs (and not only the resource path), but the current design for the Resource (Resolver/Transformer) chain is simple and cohesive -- focused mainly on the resource path. The ability to modify the domain, port, and scheme is a separate concern.

This issue is to explore the following solution:

  • configuring globally an HTTP domain for all resolved resources though ResourceUrlProvider, making it a cross-cutting concern for ResourceResolvers
  • this configuration could be done at the java config level with WebMvcConfigurerAdapter or WebMvcConfigurationSupport

Affects: 4.1 RC2

Issue Links:

  • #16488 Create ResourceResolver for changing URL domain
@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Aug 28, 2014

Brian Clozel commented

Hi Guillaume DROUET, I think this issue might interest you as well.
Does your project need to change URL domains as part of the resolvers/transformer? Or a separate setting, as suggested here is acceptable?

Thanks,

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Aug 28, 2014

Guillaume DROUET commented

Hi!

Of course! As mentionned in your twitter conversation, serving statics from a cookie less domain is important and in my project I take care of it by allowing to set several locations to use when writing URLs. So if spring allows to do it, the users may have the choice to choose between spring and third party framework as it can be done with PathResourceResolver and VersionStrategy. Sounds good to me if we can configure everything from WebMvcConfigurerAdapter...

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Apr 2, 2017

smallufo commented

Hi , I recently have the same question , and find this issue.
I noticed it is marked resolved . but I cannot find any document mentioning how to change the host of a static resource ?

related stackoverflow : http://stackoverflow.com/q/43031682/298430

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Apr 3, 2017

Brian Clozel commented

It's resolved as duplicate of #16488 - and you've commented there as well.

@spring-projects-issues spring-projects-issues added type: enhancement status: duplicate in: web labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.1 GA milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web status: duplicate type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants