Heroku Cedar 和 nginx (gzip)

发布于 2024-12-21 11:02:30 字数 753 浏览 5 评论 0原文

根据此处接受的答案中的评论 Rails 如何对 Javascript 进行 Gzip? (Heroku) 和官方 cedar 文档 (http://devcenter.heroku .com/articles/http-routing#the_herokuappcom_http_stack):

由于对 Cedar 应用程序的请求是直接向应用程序服务器发出的,而不是通过像 nginx 这样的 HTTP 服务器代理,所以任何响应压缩都必须在您的应用程序内完成。对于 Rack 应用程序,这可以通过 Rack::Deflater 中间件来完成。对于 gzip 压缩的静态资源,请确保在中间件堆栈中先加载 Rack::Deflater,然后加载 ActionDispatch::Static。

然而,据我所知,我的应用程序正在herokuapp.com(cedar)上运行,并且根据heroku日志,正在使用nginx来提供数据(这很棒)。我还通过 Content-Encoding HTTP 标头确认它正在将数据压缩到浏览器。根据文档,这不应该发生在雪松上。我在这里错过了什么吗?

According to the comments in the accepted answer here Rails how to Gzip Javascript? (Heroku) and the official cedar documentation (http://devcenter.heroku.com/articles/http-routing#the_herokuappcom_http_stack):

Since requests to Cedar apps are made directly to the application server – not proxied through an HTTP server like nginx – any compression of responses must be done within your application. For Rack apps, this can be accomplished with the Rack::Deflater middleware. For gzipped static assets, make sure that Rack::Deflater is loaded before ActionDispatch::Static in your middleware stack.

However, as far as I can tell, my app is running on herokuapp.com (cedar) and, according to the heroku logs, is using nginx to serve data (which is great). I've also confirmed via the Content-Encoding HTTP header that it is gzipping data to the browser. According to the documentation, that is NOT supposed to happen on cedar. Am I missing something here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

絕版丫頭 2024-12-28 11:02:30

您必须通过指向这些 IP 的域访问这些应用程序:

75.101.163.44
75.101.145.87
174.129.212.2

这些是顶点面,它们位于竹子和雪松应用程序的前面。清漆适用于竹子,但任何通过竹子的请求最终也会经过清漆。

这些面仅适用于顶点域。如果您的应用程序位于 www 等子域下,则应将其设置为指向 appname.herokuapp.com 的 CNAME。当这样设置时,请求将不会通过清漆。

有关 Apex 和 Heroku 的更多信息,请参阅此处:http://neilmiddleton。 com/the-dangers-of-a-records-and-heroku/

You must be accessing these apps through a domain pointing to these IPs:

75.101.163.44
75.101.145.87
174.129.212.2

These are the apex faces and they are in front of both bamboo and cedar apps. Varnish is there for bamboo, but any request that goes through them ends up going through varnish too.

These faces are only for apex domains. If your app is under a subdomain such as www, it should be setup as a CNAME pointing to appname.herokuapp.com. When setup like that, requests will not go through varnish.

For more on Apex's and Heroku, see here: http://neilmiddleton.com/the-dangers-of-a-records-and-heroku/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文