Search squid archive

Re: How to serve custom error pages with images in Squid?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/12/21 5:44 AM, roee klinger wrote:

> I am trying to serve custom error pages in Squid 4.10, this is my
> squid.comf:
> 
>     error_directory /etc/squid/pages/
>     icon_directory /etc/squid/pages/images/

> The custom error page loads, but the images are missing. In my HTML file
> I simply put:
> 
>     <img src="image.png" alt="..." class="img-fluid">
> 
> 
> but if I inspect the image in the browser, I can see it is adding the
> website URL before the image path, like so:
> 
>     http://ipinfo.io/image.png

The browser thinks the error page was generated by the origin server.
Popular browsers essentially do not recognize forward proxies as
legitimate content sources so there is no way for Squid to tell the
browser that the error page is coming from Squid itself.

If images in your error pages use a relative image path (including an
empty path like in your example above) and do not define their own base
URL using HTML, then the browser will use the _request_ URL path as the
base URL, as if the error page came from the origin server that
experienced the error.


> I tried to revert back the default error pages, however, I noticed that
> apparently even there, the images never loaded, it had the exact same issue.

Squid-generated content, including error pages, may use a
/squid-internal-static/ path that Squid can then recognize in image
requests and recognize that the user wants Squid-generated content. See
global_internal_static and short_icon_urls directives.


HTH,

Alex.
_______________________________________________
squid-users mailing list
squid-users@xxxxxxxxxxxxxxxxxxxxx
http://lists.squid-cache.org/listinfo/squid-users




[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux