gpt4 book ai didi

html - Gmail 中的电子邮件缩略图网址更改为 googleusercontent.com

转载 作者:技术小花猫 更新时间:2023-10-29 12:33:45 27 4
gpt4 key购买 nike

我有一个系统,每当用户上传图片时,它都会向注册用户的 gmail 发送一封电子邮件。但是在电子邮件中,我看到类似这样的内容,缩略图不可见。

enter image description here

我检查元素,发现 src 链接到这个 url:https://ci5.googleusercontent.com/proxy/VI2cPXWhfKZEIarh-iyKNz1j9q7Ymh8ty4Yz19lXh82RjSlACBzS0aRajfIj913uXAsX2ylcLEDs5FBsj4cR9TcU75Pw5djdHx4htxdCAQxs_ue1Q1wi5TV43uLLBpigpjH1xN747mUHSRdTBJmXQWFyykInJCRXicM1KhNk=s0-d-e1-ft#https://www.somedomain.com/files/1658/thumbnail_71JtDozxS1L._SY450_.jpg

显然它被谷歌代理缓存

但我可以通过访问 https://www.somedomain.com/files/1658/thumbnail_71JtDozxS1L._SY450_.jpg 查看没有谷歌用户内容的图像(我屏蔽了域所以图像您可能无法使用)。

我尝试清除浏览器缓存,但问题仍然存在。我怎样才能绕过 googleusercontent 东西或者至少让缩略图能够显示。

我在这个链接上结账Images not displayed for Gmail但我没有使用本地主机,图像本身可以在我的本地网络之外访问。

最佳答案

Google Image Proxy 如何工作

Google Image Proxy 是一个缓存代理服务器。每次电子邮件中包含图像链接时,请求都会首先转到 Google Image Proxy,看看它是否已被缓存,如果是,它应该从代理服务器提供它,或者它会去获取它并在之后缓存它。

大多数问题的解决方案

Google Image Proxy 服务器将在以下情况下获取您的图片:

  • 仅具有 .png.jpg/.jpeg.gif 等扩展名。也可能是 .webp。但不是.svg .
  • 不要在图像 URL 中使用任何类型的查询字符串部分,例如 ?id=123
  • 有一个直接映射到图像上的 URL。
  • 名字不长。

图片服务器要求:

  • 来自图像服务器/代理服务器的响应必须包含正确的 header ,例如 Content-Type: image/jpeg
  • 文件扩展名和content-type header 必须是同一类型。
  • 服务器响应中的状态码必须是 200 而不是 403、500 等。

还有什么可以帮助的?

Google support answer :

Set up an image URL proxy whitelist

When your users open email messages, Gmail uses Google’s secure proxy servers to serve images that might be included in these messages. This protects your users and domain against image-based security vulnerabilities.

Because of the image proxy, links to images that are dependent on internal IPs and sometimes cookies are broken. The Image URL proxy whitelist setting lets you avoid broken links to images by creating and maintaining a whitelist of internal URLs that'll bypass proxy protection.

When you configure the Image URL proxy whitelist, you can specify a set of domains and a path prefix that can be used to specify large groups of URLs. See the guidelines below for examples.

Configure the Image URL proxy whitelist setting:

  • Sign in to your Google Admin console. Sign in using your administrator account (does not end in @gmail.com).
  • From the Admin console Home page, go to Apps > G Suite > Gmail > Advanced settings. Tip: To see Advanced settings, scroll to the bottom of the Gmail page.
  • On the left, select your top-level organization.
  • Scroll to the Image URL proxy whitelist section.
  • Enter image URL proxy whitelist patterns. Matching URLs will bypass image proxy protection. See the guidelines below for more details and instructions.
  • At the bottom, click Save.

It can take up to an hour for changes to propagate to user accounts. You can track prior changes under Admin console audit log.

Guidelines for applying the Image URL proxy whitelist setting

Security considerations

Consult with your security team before configuring the Image URL proxy whitelist setting. The decision to bypass image proxy whitelist protection can expose your users and domain to security risks if not used with care.

In general, if you have a domain that needs authentication via cookie, and if that domain is controlled by an administrator within your organization and is completely trusted, then whitelisting that URL should not expose your domain to image-based attacks.

Important: Disabling the image proxy is not recommended. This option is available to provide flexibility for administrators, but disabling the image proxy can leave your users vulnerable to malicious attacks.

Entering Image URL patterns

To maintain a whitelist of internal URLs that'll bypass proxy protection, enter the image URL patterns in the Image URL proxy whitelist setting. Matching URLs will bypass the image proxy.

A pattern can contain the scheme, the domain, and a path. The pattern must always have a forward slash (/) present between the domain and path. If the URL pattern specifies a scheme, then the scheme and the domain must fully match. Otherwise, the domain can partially match the URL suffix. For example, the pattern google.com matches www.google.com, but not gle.com. The URL pattern can specify a path that's matched against the path prefix.

Important: Enter your actual domain name as you enter the image URL pattern. Always include a trailing forward slash (/) after the domain name.

Examples of Image URL patterns

The following patterns are examples only. The following patterns:

http://rule_fixed_scheme_domain.com/
rule_flex_scheme_domain.com/
rule_fixed_subpath.com/cgi-bin/

... will match the following URLs:

http://rule_fixed_scheme_domain.com/
http://rule_fixed_scheme_domain.com/test.jpg?foo=bar#frag
http://rule_fixed_scheme_domain.com
rule_flex_scheme_domain.com/
t.rule_flex_scheme_domain.com/test.jpg
http://t.rule_flex_scheme_domain.com/test.jpg
https://t.rule_flex_scheme_domain.com/test.jpg
http://rule_fixed_subpath.com/cgi-bin/
http://rule_fixed_subpath.com/cgi-bin/people

Note: The URL scheme (http://) is optional. If the scheme is omitted, the pattern can match any scheme, and allows partial matches on the domain suffix.

Previewing the image URL patterns

Click Preview to see if the URLs match the image URL patterns you've set. If the image URL matches a pattern, you'll see a confirmation message. If the image URL does not match, an error message appears.

关于html - Gmail 中的电子邮件缩略图网址更改为 googleusercontent.com,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51471607/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com