简体   繁体   English

X-Accel-Redirect 从外部工作,但不能从内部工作

[英]X-Accel-Redirect works from outside, but not from inside

So here's my thing.所以这是我的事情。 Got a php app running on nginx/dokku.在 nginx/dokku 上运行了一个 php 应用程序。

I have a location which is redirecting image assets.我有一个重定向图像资产的位置。 Say:说:

https://test.rokfor.ch/cdn/dummyimage.com/600x400/000/fff

Results in a image, shown in the Browser.结果在浏览器中显示的图像。

Calling the same resource within a php script like:在 php 脚本中调用相同的资源,例如:

header('X-Accel-Redirect: /cdn/dummyimage.com/600x400/000/fff');
exit(0);

Results in an internal error.导致内部错误。 Nginx config looks like: Nginx 配置看起来像:

location ~ ^/cdn/(.*?)/(.*) {
  resolver 8.8.8.8;
  proxy_set_header HOST $1;
  proxy_pass "https://$1/$2?$args";
}

What could be potiential issues?什么可能是潜在的问题? Since I don't know in which direction to look.因为不知道往哪个方向看。

Ok - found it out:好的 - 发现了:

Dokku runs internally Nginx 1.8 without SSL support. Dokku 在不支持 SSL 的情况下在内部运行 Nginx 1.8。 Proxy_pass to https therefore cannot work. Proxy_pass 到 https 因此无法工作。 I managed to work around the problem by forking the original heroku php buildpack, pushed the nginx dependency to 1.10 and added an additional repository providing a nginx version built with ssl support.我设法通过 fork 原始 heroku php buildpack 来解决这个问题,将 nginx 依赖项推送到 1.10 并添加了一个额外的存储库,提供了一个使用 ssl 支持构建的 nginx 版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM