Quantcast

disabling static resource stuff

classic Classic list List threaded Threaded
28 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

disabling static resource stuff

Robert McIntosh
Unfortunately the new resource stuff has completely broken my app. After removing my use of the resource tag, something is still intercepting calls to images and such and not showing them. For example I have a link from a css file to an image, that looks something like:

../images/bg-tile.png

doesn't work like it used to. I can't even hit it directly via context/images/bg-tile.png.

I've tried setting different config parameters, such as:

grails.resources.processing.enabled = false

and the adhoc ones. Nothing seems to make it work or stop putting in the /static/ url. I don't want /static/ in my urls. I tried setting the prefix to null and it ignores it. Tried setting it to a blank string and I get context//images/blah (double slash). Surely it is possible to get this to behave the way it did in 1.3.7?

robert
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disabling static resource stuff

zyro
did u probably miss the new config entry

// What URL patterns should be processed by the resources plugin
grails.resources.adhoc.patterns = ['/images/*', '/css/*', '/js/*',
'/plugins/*']

that is in Config.groovy by default?

-------- Original Message  --------
Subject: [grails-user] disabling static resource stuff
From: Robert McIntosh <[hidden email]>
To: [hidden email]
Date: Tue, 20 Sep 2011 11:21:16 -0500

> Unfortunately the new resource stuff has completely broken my app. After
> removing my use of the resource tag, something is still intercepting
> calls to images and such and not showing them. For example I have a link
> from a css file to an image, that looks something like:
>
> ../images/bg-tile.png
>
> doesn't work like it used to. I can't even hit it directly via
> context/images/bg-tile.png.
>
> I've tried setting different config parameters, such as:
>
> grails.resources.processing.enabled = false
>
> and the adhoc ones. Nothing seems to make it work or stop putting in the
> /static/ url. I don't want /static/ in my urls. I tried setting the
> prefix to null and it ignores it. Tried setting it to a blank string and
> I get context//images/blah (double slash). Surely it is possible to get
> this to behave the way it did in 1.3.7?
>
> robert

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disabling static resource stuff

Robert McIntosh
yep, tried that. I keep getting redirected to /static/images/

On Tue, Sep 20, 2011 at 11:25 AM, zyro <[hidden email]> wrote:
did u probably miss the new config entry

// What URL patterns should be processed by the resources plugin
grails.resources.adhoc.patterns = ['/images/*', '/css/*', '/js/*', '/plugins/*']

that is in Config.groovy by default?


-------- Original Message  --------
Subject: [grails-user] disabling static resource stuff
From: Robert McIntosh <[hidden email]>
To: [hidden email]
Date: Tue, 20 Sep 2011 11:21:16 -0500

Unfortunately the new resource stuff has completely broken my app. After
removing my use of the resource tag, something is still intercepting
calls to images and such and not showing them. For example I have a link
from a css file to an image, that looks something like:

../images/bg-tile.png

doesn't work like it used to. I can't even hit it directly via
context/images/bg-tile.png.

I've tried setting different config parameters, such as:

grails.resources.processing.enabled = false

and the adhoc ones. Nothing seems to make it work or stop putting in the
/static/ url. I don't want /static/ in my urls. I tried setting the
prefix to null and it ignores it. Tried setting it to a blank string and
I get context//images/blah (double slash). Surely it is possible to get
this to behave the way it did in 1.3.7?

robert

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disabling static resource stuff

Robert McIntosh
In reply to this post by zyro
not to mention that is kills all my nice SEF urls. I have an ecommerce app, so each product page is a custom url, such as:

context/widget.html

where "widget" is mapped internally, not using the UrlMappings or standard controller/action setup.

my config has:

grails.resources.adhoc.patterns = ["*.html","/images/*", "/css/*"]

robert

On Tue, Sep 20, 2011 at 11:25 AM, zyro <[hidden email]> wrote:
did u probably miss the new config entry

// What URL patterns should be processed by the resources plugin
grails.resources.adhoc.patterns = ['/images/*', '/css/*', '/js/*', '/plugins/*']

that is in Config.groovy by default?


-------- Original Message  --------
Subject: [grails-user] disabling static resource stuff
From: Robert McIntosh <[hidden email]>
To: [hidden email]
Date: Tue, 20 Sep 2011 11:21:16 -0500

Unfortunately the new resource stuff has completely broken my app. After
removing my use of the resource tag, something is still intercepting
calls to images and such and not showing them. For example I have a link
from a css file to an image, that looks something like:

../images/bg-tile.png

doesn't work like it used to. I can't even hit it directly via
context/images/bg-tile.png.

I've tried setting different config parameters, such as:

grails.resources.processing.enabled = false

and the adhoc ones. Nothing seems to make it work or stop putting in the
/static/ url. I don't want /static/ in my urls. I tried setting the
prefix to null and it ignores it. Tried setting it to a blank string and
I get context//images/blah (double slash). Surely it is possible to get
this to behave the way it did in 1.3.7?

robert

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disabling static resource stuff

Graeme Rocher-4
Administrator
If you don't want the resources handling you can remove the plugin.
Just comment out/delete the following line in BuildConfig.groovy:

compile ":resources:1.0.2"

Cheers

On Tue, Sep 20, 2011 at 6:56 PM, Robert McIntosh <[hidden email]> wrote:

> not to mention that is kills all my nice SEF urls. I have an ecommerce app,
> so each product page is a custom url, such as:
>
> context/widget.html
>
> where "widget" is mapped internally, not using the UrlMappings or standard
> controller/action setup.
>
> my config has:
>
> grails.resources.adhoc.patterns = ["*.html","/images/*", "/css/*"]
>
> robert
>
> On Tue, Sep 20, 2011 at 11:25 AM, zyro <[hidden email]> wrote:
>>
>> did u probably miss the new config entry
>>
>> // What URL patterns should be processed by the resources plugin
>> grails.resources.adhoc.patterns = ['/images/*', '/css/*', '/js/*',
>> '/plugins/*']
>>
>> that is in Config.groovy by default?
>>
>> -------- Original Message  --------
>> Subject: [grails-user] disabling static resource stuff
>> From: Robert McIntosh <[hidden email]>
>> To: [hidden email]
>> Date: Tue, 20 Sep 2011 11:21:16 -0500
>>
>>> Unfortunately the new resource stuff has completely broken my app. After
>>> removing my use of the resource tag, something is still intercepting
>>> calls to images and such and not showing them. For example I have a link
>>> from a css file to an image, that looks something like:
>>>
>>> ../images/bg-tile.png
>>>
>>> doesn't work like it used to. I can't even hit it directly via
>>> context/images/bg-tile.png.
>>>
>>> I've tried setting different config parameters, such as:
>>>
>>> grails.resources.processing.enabled = false
>>>
>>> and the adhoc ones. Nothing seems to make it work or stop putting in the
>>> /static/ url. I don't want /static/ in my urls. I tried setting the
>>> prefix to null and it ignores it. Tried setting it to a blank string and
>>> I get context//images/blah (double slash). Surely it is possible to get
>>> this to behave the way it did in 1.3.7?
>>>
>>> robert
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>   http://xircles.codehaus.org/manage_email
>>
>>
>
>



--
Graeme Rocher
Grails Project Lead
SpringSource - A Division of VMware
http://www.springsource.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disabling static resource stuff

Robert McIntosh
thanks

On Tue, Sep 20, 2011 at 1:04 PM, Graeme Rocher <[hidden email]> wrote:
If you don't want the resources handling you can remove the plugin.
Just comment out/delete the following line in BuildConfig.groovy:

compile ":resources:1.0.2"

Cheers

On Tue, Sep 20, 2011 at 6:56 PM, Robert McIntosh <[hidden email]> wrote:
> not to mention that is kills all my nice SEF urls. I have an ecommerce app,
> so each product page is a custom url, such as:
>
> context/widget.html
>
> where "widget" is mapped internally, not using the UrlMappings or standard
> controller/action setup.
>
> my config has:
>
> grails.resources.adhoc.patterns = ["*.html","/images/*", "/css/*"]
>
> robert
>
> On Tue, Sep 20, 2011 at 11:25 AM, zyro <[hidden email]> wrote:
>>
>> did u probably miss the new config entry
>>
>> // What URL patterns should be processed by the resources plugin
>> grails.resources.adhoc.patterns = ['/images/*', '/css/*', '/js/*',
>> '/plugins/*']
>>
>> that is in Config.groovy by default?
>>
>> -------- Original Message  --------
>> Subject: [grails-user] disabling static resource stuff
>> From: Robert McIntosh <[hidden email]>
>> To: [hidden email]
>> Date: Tue, 20 Sep 2011 11:21:16 -0500
>>
>>> Unfortunately the new resource stuff has completely broken my app. After
>>> removing my use of the resource tag, something is still intercepting
>>> calls to images and such and not showing them. For example I have a link
>>> from a css file to an image, that looks something like:
>>>
>>> ../images/bg-tile.png
>>>
>>> doesn't work like it used to. I can't even hit it directly via
>>> context/images/bg-tile.png.
>>>
>>> I've tried setting different config parameters, such as:
>>>
>>> grails.resources.processing.enabled = false
>>>
>>> and the adhoc ones. Nothing seems to make it work or stop putting in the
>>> /static/ url. I don't want /static/ in my urls. I tried setting the
>>> prefix to null and it ignores it. Tried setting it to a blank string and
>>> I get context//images/blah (double slash). Surely it is possible to get
>>> this to behave the way it did in 1.3.7?
>>>
>>> robert
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>   http://xircles.codehaus.org/manage_email
>>
>>
>
>



--
Graeme Rocher
Grails Project Lead
SpringSource - A Division of VMware
http://www.springsource.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disabling static resource stuff

Marc Palmer Local
In reply to this post by Robert McIntosh

On 20 Sep 2011, at 17:21, Robert McIntosh wrote:

> Unfortunately the new resource stuff has completely broken my app. After removing my use of the resource tag, something is still intercepting calls to images and such and not showing them. For example I have a link from a css file to an image, that looks something like:
>

Hi Robert,

Feels like I've been chasing you around the web today.

I replied to your comment on the resources article on my blog earlier today, and Peter told me you left a similar one on his - which nobody apparently apart from him can see yet due to caching.

Anyway... I think there is some major misunderstanding. This stuff does work.

> ../images/bg-tile.png
>
> doesn't work like it used to. I can't even hit it directly via context/images/bg-tile.png.
>

That seems strange. It will redirect them to /static/xxx and should serve them up fine. What exactly is happening.

It won't work if you are (a) having it process your HTML and (b) have Cached-resources installed - this is because your directories will be flattened and ../ will not work any more.

You don't want it to process your static HTML files.

> I've tried setting different config parameters, such as:
>
> grails.resources.processing.enabled = false
>
> and the adhoc ones. Nothing seems to make it work or stop putting in the /static/ url. I don't want /static/ in my urls. I tried setting the prefix to null and it ignores it. Tried setting it to a blank string and I get context//images/blah (double slash). Surely it is possible to get this to behave the way it did in 1.3.7?


If you installed the resources plugin you presumably want its functionality. This requires a URI prefix being added, period.

The URI prefix is added so that it can serve up your modified (optimized) resource.

If you do not want it to process certain ad-hoc resources (resources you have not declared in modules) you need to tell it not do so.

This is achieved through a combination of:

grails.resources.adhoc.patterns = ... list of SERVLET SDK patterns to INCLUDE in ad hoc processing

Your previous mail shows you put .html in here. That means you are explicitly telling it to process HTML. Why would you want to do that? This will cause your /static/ prefix problem for your static HTML files.

The above setting is coarse - due to limitations of Servlet SDK patterns (*.type or /folder/* only).

However there are finer settings that act after those high level patterns:

grails.resources.adhoc.includes
grails.resources.adhoc.excludes

These both accept lists of ANT style patterns. Note that there was a bug until recently where excluded resources would still be linked to with /static/ prefix, but I am not convinced this is your difficulty.

See http://grails-plugins.github.com/grails-resources/guide/9.%20Configuration.html
("Controlling the includes and excludes of the adhoc filter: grails.resources.adhoc.includes/excludes")

Out of the box Resources does not process HTML. You have set it so that it will. If you revert to the normal default configuration, please tell me what symptoms you are seeing (if you do want to use resources plugin for optimisation) and then I can help you properly.

Kind regards,
Marc

~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java)

Founder @ http://noticelocal.com | Developer @ http://weceem.org
Member @ http://spottymushroom.com | Contributor @ http://grails.org
Twitter: http://twitter.com/wangjammer5 | Resumé: http://www.anyware.co.uk/marc/
Blog: http://www.anyware.co.uk | Grails Rocks: http://www.grailsrocks.com


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disabling static resource stuff

pledbrook
In reply to this post by Robert McIntosh
> not to mention that is kills all my nice SEF urls. I have an ecommerce app,
> so each product page is a custom url, such as:
>
> context/widget.html
>
> where "widget" is mapped internally, not using the UrlMappings or standard
> controller/action setup.

So who is handling this mapping? Do you have any sample code? GSP
fragments + whatever code is handling the requests and doing the
internal mapping. It would be great to understand the use case to see
whether there is a potential issue with Resources.

Thanks,

Peter

--
Peter Ledbrook
Grails Advocate
SpringSource - A Division of VMware

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disabling static resource stuff

Arjang
In reply to this post by Marc Palmer Local
Hi Marc

I have the same issue with Resources plugin.  We have not change any default setting.  

Symptom :  We have build several POCs.  At random one or more resources are missing from one or other or both websphere server in the cluster.  I traced it to the /temp/ directory and in fact assets (/images, /js, ...) are missing from /temp directory.

Any Suggestion?

Tech Stack
=========
java 1.6
Grails 2.0.3
Cluster websphere 8
IHS
AIX




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disabling static resource stuff

Marc Palmer Local

On 5 Jul 2012, at 03:54, arjang wrote:

> Hi Marc
>
> I have the same issue with Resources plugin.  We have not change any default
> setting.  
>
> Symptom :  We have build several POCs.  At random one or more resources are
> missing from one or other or both websphere server in the cluster.  I traced
> it to the /temp/ directory and in fact assets (/images, /js, ...) are
> missing from /temp directory.
>
> Any Suggestion?
>
> Tech Stack
> =========
> java 1.6
> Grails 2.0.3
> Cluster websphere 8
> IHS
> AIX


Hi,

Which version of resources are you using? 1.2-RC1 solves the problem with resources that are requested from a box without sticky sessions, where that same box was not asked to generate the link, not resolving after a container restart.

Marc

~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)

I offer commercial support for Grails plugins from as low as $50/mo.
For details see: http://grailsrocks.com

Blog: http://www.anyware.co.uk | Resumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org |  Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5 


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disabling static resource stuff

Arjang
We are using Grails 2.0.3 that comes with resources - 1.1.6.  
Should I wait for next Grails version?  I can build another POC and QA in cluster IBM servers np.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disabling static resource stuff

Marc Palmer Local

On 5 Jul 2012, at 14:40, Arjang wrote:

> We are using Grails 2.0.3 that comes with resources - 1.1.6.  
> Should I wait for next Grails version?  I can build another POC and QA in
> cluster IBM servers np.
>

No, just use 1.2-RC1 and see how you get on. This release solved exactly this problem.

Marc

~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)

I offer commercial support for Grails plugins from as low as $50/mo.
For details see: http://grailsrocks.com

Blog: http://www.anyware.co.uk | Resumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org |  Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5 


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disabling static resource stuff

Arjang
I have done the first tests of 1.2-RC1 with Cluster Websphere8.  it seems to be working just fine.

Thanks Marc
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disabling static resource stuff

Timur
In reply to this post by Marc Palmer Local
Hello Marc,

I run into the same issue - without sticky session, page is requested from node1, node1 prepares resources, but then some of resource requests are coming to node2 which have not yet prepared resources and I have 404 for these resources.

I am using resources plugin 1.2RC3 and Grails 2.2.0.

Also I looked into JIRA http://jira.grails.org/browse/GPRESOURCES/fixforversion/12819 and can't see fixes related to cluster / session affinity. Search by JIRA by keyword cluster, session also gives no relevant issues to me.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disabling static resource stuff

Marc Palmer Local

On 14 Feb 2013, at 06:28, tty <[hidden email]> wrote:

> Hello Marc,
>
> I run into the same issue - without sticky session, page is requested from
> node1, node1 prepares resources, but then some of resource requests are
> coming to node2 which have not yet prepared resources and I have 404 for
> these resources.
>
> I am using resources plugin 1.2RC3 and Grails 2.2.0.


I'm not aware of any ongoing issues with that since 1.2RCs. Have you tested with just Resources and no other mappers installed?

Just to eliminate other issues... because I know there is an odd issue in Cached Resources somewhere.

Marc

~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)

Grails Plugins: http://grailsrocks.com
Blog: http://www.anyware.co.uk | Résumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org | Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5 


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disabling static resource stuff

Timur
Marc Palmer Local wrote
On 14 Feb 2013, at 06:28, tty <[hidden email]> wrote:

> I run into the same issue - without sticky session, page is requested from
> node1, node1 prepares resources, but then some of resource requests are
> coming to node2 which have not yet prepared resources and I have 404 for
> these resources.

I'm not aware of any ongoing issues with that since 1.2RCs. Have you tested with just Resources and no other mappers installed?

Just to eliminate other issues... because I know there is an odd issue in Cached Resources somewhere.
Thanks, Marc. Reason is exactly in Cached Resources mapper. It replacing filenames in links with hash values and also renaming resources. Another node is not aware of renamed resource before it prepares it.

Has anyone solve this issue with Cached Resources mapper in clustered environment ?

Another reason I want to have distributed static resources storage is to support hot deployment, for example we deploy new application version to node1, it has new resource which is not yet deployed to node2. Idea is to have this resource visible for CloudFront to serve node1 users. But CloudFrond could go to node2 through load balancer and will receive 404.

That is another reason to have distributed (shared between nodes) resources storage as CloudFront origin.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disabling static resource stuff

Marc Palmer Local

On 14 Feb 2013, at 13:39, tty <[hidden email]> wrote:

> Marc Palmer Local wrote
>> On 14 Feb 2013, at 06:28, tty &lt;
>
>> ttyusupov@
>
>> &gt; wrote:
>>
>>> I run into the same issue - without sticky session, page is requested
>>> from
>>> node1, node1 prepares resources, but then some of resource requests are
>>> coming to node2 which have not yet prepared resources and I have 404 for
>>> these resources.
>>
>> I'm not aware of any ongoing issues with that since 1.2RCs. Have you
>> tested with just Resources and no other mappers installed?
>>
>> Just to eliminate other issues... because I know there is an odd issue in
>> Cached Resources somewhere.
>
> Thanks, Marc. Reason is exactly in Cached Resources mapper. It replacing
> filenames in links with hash values and also renaming resources. Another
> node is not aware of renamed resource before it prepares it.
>
> Has anyone solve this issue with Cached Resources mapper in clustered
> environment ?
>
> Another reason I want to have distributed static resources storage is to
> support hot deployment, for example we deploy new application version to
> node1, it has new resource which is not yet deployed to node2. Idea is to
> have this resource visible for CloudFront to serve node1 users. But
> CloudFrond could go to node2 through load balancer and will receive 404.
>
> That is another reason to have distributed (shared between nodes) resources
> storage as CloudFront origin.
>


If you are going to link to resources (with or wither Resources or other plugins) that exist on one machine and not another, you are going to get 404s. This is not something specific to Resources.

I suspect you need to change the way you redeploy / use a CDN.

At the very least, sticky sessions on a load balancer would reduce this problem.

If you can't do that then you need to make sure CloudFront only makes requests into one specific host, most likely the first one you update when doing anew deploy.

Marc
~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)

Grails Plugins: http://grailsrocks.com
Blog: http://www.anyware.co.uk | Résumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org | Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5 


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disabling static resource stuff

Timur
Marc Palmer Local wrote
If you are going to link to resources (with or wither Resources or other plugins) that exist on one machine and not another, you are going to get 404s. This is not something specific to Resources.

I suspect you need to change the way you redeploy / use a CDN.

At the very least, sticky sessions on a load balancer would reduce this problem.

If you can't do that then you need to make sure CloudFront only makes requests into one specific host, most likely the first one you update when doing anew deploy.
May be I explained the issue not very clear. Let me clarify. Even if resource is present on both hosts, I mean present in its original location, e.g. img/throbber.gif, when we use cached-resources mapper here is what happens after both hosts restart:

1) Hashed URL .../static/8owVPywEaT1AZbsda0Ay9GW1DWzOQjEMuaJzyKfHVcq.gif is not available on both hosts until page using resource is requested.
2) User requests search page and forwarded by load balancer to host1, host1 processes resources used by this page and from this point host1://static/8owVPywEaT1AZbsda0Ay9GW1DWzOQjEMuaJzyKfHVcq.gif is available, while host2://static/8owVPywEaT1AZbsda0Ay9GW1DWzOQjEMuaJzyKfHVcq.gif is still not available
3) Search page is returned from host1 to user with links replaced to load-balancer://static/8owVPywEaT1AZbsda0Ay9GW1DWzOQjEMuaJzyKfHVcq.gif
4) User browser is trying to download load-balancer://static/8owVPywEaT1AZbsda0Ay9GW1DWzOQjEMuaJzyKfHVcq.gif, load balancer forwards request to host2 and get 404 from host2://static/8owVPywEaT1AZbsda0Ay9GW1DWzOQjEMuaJzyKfHVcq.gif

So, until resource is processed by cached-resources mapper it is not available by hashed URL from the host even if it is available by original URL.

I am trying to find the solution which allows to use hash URLs without sticky session in clustered environment.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disabling static resource stuff

Marc Palmer Local

On 15 Feb 2013, at 13:47, Timur <[hidden email]> wrote:

> Marc Palmer Local wrote
>> If you are going to link to resources (with or wither Resources or other
>> plugins) that exist on one machine and not another, you are going to get
>> 404s. This is not something specific to Resources.
>>
>> I suspect you need to change the way you redeploy / use a CDN.
>>
>> At the very least, sticky sessions on a load balancer would reduce this
>> problem.
>>
>> If you can't do that then you need to make sure CloudFront only makes
>> requests into one specific host, most likely the first one you update when
>> doing anew deploy.
>
> May be I explained the issue not very clear. Let me clarify. Even if
> resource is present on both hosts, I mean present in its original location,
> e.g. img/throbber.gif, when we use cached-resources mapper here is what
> happens after both hosts restart:
>
> 1) Hashed URL .../static/8owVPywEaT1AZbsda0Ay9GW1DWzOQjEMuaJzyKfHVcq.gif is
> not available on both hosts until page using resource is requested.
> 2) User requests search page and forwarded by load balancer to host1, host1
> processes resources used by this page and from this point
> host1://static/8owVPywEaT1AZbsda0Ay9GW1DWzOQjEMuaJzyKfHVcq.gif is available,
> while host2://static/8owVPywEaT1AZbsda0Ay9GW1DWzOQjEMuaJzyKfHVcq.gif is
> still not available
> 3) Search page is returned from host1 to user with links replaced to
> load-balancer://static/8owVPywEaT1AZbsda0Ay9GW1DWzOQjEMuaJzyKfHVcq.gif
> 4) User browser is trying to download
> load-balancer://static/8owVPywEaT1AZbsda0Ay9GW1DWzOQjEMuaJzyKfHVcq.gif, load
> balancer forwards request to host2 and get 404 from
> host2://static/8owVPywEaT1AZbsda0Ay9GW1DWzOQjEMuaJzyKfHVcq.gif
>
> So, until resource is processed by cached-resources mapper it is not
> available by hashed URL from the host even if it is available by original
> URL.
>
> I am trying to find the solution which allows to use hash URLs without
> sticky session in clustered environment.


OK,

The problem you are experiencing is that you are using r:img and this for ad-hoc resources (inline images) and as such they are not available/processed until the HTML page that links to them has been rendered on that machine.

The only solutions are:

1) declare your images in modules so they are processed at startup, but never rendered (nothing will "require" that module)

or

2) don't use r:img for the images (complicated because in grails 2 g:resource will delegate to r:resource anyway and process it

or

3) Exclude those images from processing using excludes patterns.

Marc
~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)

Grails Plugins: http://grailsrocks.com
Blog: http://www.anyware.co.uk | Résumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org | Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5 


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disabling static resource stuff

Timur
Marc Palmer Local wrote
OK,

The problem you are experiencing is that you are using r:img and this for ad-hoc resources (inline images) and as such they are not available/processed until the HTML page that links to them has been rendered on that machine.

The only solutions are:

1) declare your images in modules so they are processed at startup, but never rendered (nothing will "require" that module)

or

2) don't use r:img for the images (complicated because in grails 2 g:resource will delegate to r:resource anyway and process it

or

3) Exclude those images from processing using excludes patterns.
Thanks, Marc.

About solution 1) - I have tried to declare images using wildcards, but seems it is not supported. Is support for wildcards in resources declaration planned for future versions?

Also do you know if there is already implemented resource mapper which puts resources to S3 bucket? As I understand MapperPhase.DISTRIBUTION was designed for such kind of mappers.
12
Loading...