incubator-pagespeed-mod icon indicating copy to clipboard operation
incubator-pagespeed-mod copied to clipboard

Rewrite URLs in JSON files

Open GoogleCodeExporter opened this issue 9 years ago • 6 comments

we could expose a feature like this:

   ModPagespeedJsonRewriteValue Image URL_S

With this specified, we would assume any JSON name/value pair with name==URL_S 
would have a value that was a rewritable image.  Or we could specify it 
differently

   ModPagespeedJsonRewritePattern Image *.jpg,*.png,**.gif

which would do something more like what you suggested.

To anyone else listening: would this be a valuable feature?


The first arg of both of these would be "Image", "Script", or "Stylesheet", but 
probably "Image" would be most common.

Original issue reported on code.google.com by [email protected] on 25 Mar 2014 at 12:56

GoogleCodeExporter avatar Apr 06 '15 16:04 GoogleCodeExporter

Original comment by [email protected] on 15 Apr 2014 at 11:54

GoogleCodeExporter avatar Apr 06 '15 16:04 GoogleCodeExporter

Would be great! Missing this feature is the primary reason for using text/html 
as Ajax response.

Original comment by [email protected] on 16 Apr 2014 at 5:38

GoogleCodeExporter avatar Apr 06 '15 16:04 GoogleCodeExporter

Any update on this ? that would be very interesting as more and more websites are turning into applications requesting JSON (That may eventually contains links to images).

Thank.

kedare avatar Dec 19 '16 14:12 kedare

I don't believe we have any plans to work on this at the moment. As jmarantz originally suggested, it would absolutely need to be opt-in because re-writing URLs in JSON sounds pretty risky.

In the meantime, In-Place Resource Optimization can improve the content of links in the JSON, though you won't get the benefits that require URL re-writing:

https://developers.google.com/speed/pagespeed/module/system#ipro

hillsp avatar Dec 19 '16 20:12 hillsp

Yes of course that something quite risky that should not be enabled by default. A good way should be to have some configuration parameters like restricting the JSON fields that can be rewritten and of course the path :)

I'm gonna take a look at the inplace one.

Thanks

kedare avatar Dec 20 '16 09:12 kedare

A great concrete problem description for this plus a hacky way that may accomplish this was discussed over at https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/mod-pagespeed-discuss/6ThbvfJ4UnY/YMUCdOZJBQAJ

oschaaf avatar May 28 '19 21:05 oschaaf