Heroku反向代理(对于WordPress)不会显示完整页面 [英] Reverse Proxy with Heroku (for Wordpress) won't show full pages

查看:158
本文介绍了Heroku反向代理(对于WordPress)不会显示完整页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试使用反向代理服务在Heroku上运行的Rail应用程序中的EC2上运行的Wordpress博客。我使用了rack-reverse-proxy gem并遵循如下指示:


如何使用子目录而不是子域?


我的应用程序运行在 http://myapp.com ,我的主要目标(wordpress)服务器正在运行at http://ec2-xx-xx-xx-xx.us-west-2.compute.amazonaws.com



目标服务器上的页面在直接访问时都可以正常工作。但是,无论我尝试通过反向代理获取哪个网页,HTML都会被截断。我已经尝试通过我自己在Ubuntu(EC2)上的Wordpress自定义构建以及Bluehost等托管示例提供服务。我试图访问简单的手工制作的HTML和文本测试文件,以及wordpress自动生成的php文件。每一次,文件都被截断了。


  • 在大约1000个字符之后文本文件被随机截取(这是可变的)
  • >
  • 手动编码HTML文件的同上

  • < head> (通常是中间字)并呈现一个空的< body>

  • 如果网页存在(例如 http://ec2-xx-xx-xx-xx.us-west-2.compute.amazonaws.com/ test-post ,它会加载(至少部分)在 myapp.com/blog/test-post ,所以我不知道重写是问题。



我已经在wordpress / destination服务器上尝试了足够的变量,我倾向于认为它是Rails方面的一部分(我在本地或在Heroku测试服务器上运行myapp也有同样的问题)除此之外,我被卡住了。



对于我可能会做错的想法有什么错误?Apache日志中没有任何东西可以表明任何东西正在被切断,我对此毫无用处,并且非常感谢任何帮助。 p>

解决方案

固定IT!



反向代理宝石,我发现我不是唯一一个对此有疑问的人:




看到Content-Length被破坏的一些问题,这确保它匹配交付的身体长度。


该修复程序尚未合并到主分支中,但我分叉我自己的副本,应用修补程序,它的工作很好。希望它会合并到主人手中,而其他人不必担心这一点。





编辑



还有一件事对其他人可能有帮助,如果他们在使用可视化编辑模式时不能在wordpress下工作,请确保您还包含此更新,以正确传递标题。几年之后,这款宝石还没有真正更新过,所以您需要经过并复制其他人的修补程序。应用这两个修复程序,使Heroku应用程序/ AWS& Ubuntu Wordpress设置适用于我。


I am trying to use a reverse proxy to serve a Wordpress blog running on EC2 at /blog from a rails app running on Heroku. I've used the rack-reverse-proxy gem and followed directions like this:

How can I use a subdirectory instead of a subdomain?

My app is running at http://myapp.com, my main target (wordpress) server is running at http://ec2-xx-xx-xx-xx.us-west-2.compute.amazonaws.com.

The pages on the target server all serve up fine when accessed directly. However, no matter what page I try to get through the reverse proxy, the HTML gets cut off. I've tried serving via both my own custom builds of Wordpress on Ubuntu (EC2) and on hosted examples like Bluehost. I've tried to access simple, handmade HTML and text test files, as well as the php files automatically generated by wordpress. Every time, the file is cut off.

  • Text files just get randomly cut off after ~1000 characters (this is variable)
  • Ditto for hand-coded HTML files
  • Wordpress files seem to get cutoff during the <head> (often mid-word) and render an empty <body>.
  • If a page should exist (e.g. http://ec2-xx-xx-xx-xx.us-west-2.compute.amazonaws.com/test-post, it will load (at least partially) at myapp.com/blog/test-post, so I don't know that rewrites are the issue.

I've tried enough variables on the wordpress/destination server that I'm inclined to think it's something on the Rails side (I have the same issue whether running "myapp" locally or on a Heroku test server). Beyond that, I'm stuck.

Any thoughts as to what I might be doing wrong? There's nothing in the Apache logs to indicate that anything is getting cut off. I'm pounding my head over this to no avail, and would really appreciate any help.

解决方案

FIXED IT!

Digging into the rack-reverse-proxy gem, I found that I'm not the only person that had an issue with this:

Seeing some issues with Content-Length being corrupted, this ensures it matches body length as delivered.

The fix hasn't been merged into the master branch, but I forked my own copy, applied the fix, and it's working great. Hopefully it'll be merged into the master and nobody else will have to worry about this.


EDIT

One more thing that might be helpful for somebody else, if they are having problems with Visual Editing Mode not working under wordpress: Make sure that you also include this update to have the headers get passed in properly. The gem just hasn't really been updated in a couple of years, so it's up to you to go through and copy in fixes from other people. Applying those two fixes has everything working fine for me with a Heroku app/AWS&Ubuntu Wordpress setup.

这篇关于Heroku反向代理(对于WordPress)不会显示完整页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆