刚刚使用heroku-18和meteor-buildpack-horse将我的meteor应用程序部署到heroku . 这是部署v116 . 在以前的部署中,我能够在我的应用程序上使用Cloudflare灵活的SSL配置,但在部署v116后,页面会重定向到登录路由 . 正如我从日志中看到的,我认为它可能与状态为101(交换协议)的日志条目有关 .

如果我通过http://app.domain.com访问我的应用程序,它可以正常工作,但使用https://app.domain.com访问它不会 .

Heroku app logs

2018-10-17T23:52:16.299384+00:00 heroku[router]: at=info method=GET path="/sockjs/048/yk_lctvs/websocket" host=app.domain.com request_id=8d322763-1141-4217-94e1-5b390e1e9739 fwd="181.95.179.168,162.158.123.96" dyno=web.1 connect=1ms service=765ms status=101 bytes=175 protocol=http

2018-10-17T23:52:16.336802+00:00 heroku[router]: at=info method=GET path="/login" host=app.domain.com request_id=9d1fe273-3abb-4ecf-996f-ced82b07117e fwd="181.95.179.168,162.158.123.114" dyno=web.1 connect=1ms service=9ms status=200 bytes=4442 protocol=http

2018-10-17T23:52:16.512511+00:00 heroku[router]: at=info method=GET path="/sockjs/info?cb=5g7x6pmg9k" host=app.domain.com request_id=dfd71b44-5b95-42b3-b02f-bd118e91804a fwd="181.95.179.168,162.158.123.114" dyno=web.1 connect=1ms service=3ms status=200 bytes=363 protocol=http

2018-10-17T23:52:17.119755+00:00 heroku[router]: at=info method=GET path="/sockjs/info?cb=jadymh88hj" host=app.domain.com request_id=0febb4b3-107a-41ad-b427-6f187a32c3b2 fwd="181.95.179.168,162.158.123.114" dyno=web.1 connect=0ms service=4ms status=200 bytes=363 protocol=http

2018-10-17T23:52:18.401775+00:00 heroku[router]: at=info method=GET path="/sockjs/559/3by4bm5x/websocket" host=app.domain.com request_id=85b5cf5b-7c75-4472-9a0e-46c76c8cd534 fwd="181.95.179.168,162.158.123.95" dyno=web.1 connect=0ms service=664ms status=101 bytes=175 protocol=http

2018-10-17T23:52:18.410152+00:00 heroku[router]: at=info method=GET path="/login" host=app.domain.com request_id=ebd62bbc-a041-40aa-9c21-e15414655a59 fwd="181.95.179.168,162.158.123.114" dyno=web.1 connect=1ms service=7ms status=200 bytes=4442 protocol=http

2018-10-17T23:52:18.616711+00:00 heroku[router]: at=info method=GET path="/sockjs/info?cb=7k081p4ay5" host=app.domain.com request_id=a780d8d5-a149-4a55-a43d-b9be9dbfd1bc fwd="181.95.179.168,162.158.123.114" dyno=web.1 connect=0ms service=1ms status=200 bytes=363 protocol=http

2018-10-17T23:52:19.144127+00:00 heroku[router]: at=info method=GET path="/sockjs/info?cb=3zq5040dzp" host=app.domain.com request_id=a86deb0d-8ee1-4ed6-9c60-88ea639afb7e fwd="181.95.179.168,162.158.123.114" dyno=web.1 connect=1ms service=2ms status=200 bytes=363 protocol=http

2018-10-17T23:52:20.417289+00:00 heroku[router]: at=info method=GET path="/login" host=app.domain.com request_id=1f7bf690-22a2-44c6-bfc2-76de3bef3558 fwd="181.95.179.168,162.158.123.114" dyno=web.1 connect=1ms service=7ms status=200 bytes=4442 protocol=http

2018-10-17T23:52:20.405086+00:00 heroku[router]: at=info method=GET path="/sockjs/802/r48516e0/websocket" host=app.domain.com request_id=2f733dc7-2d60-4770-b83d-52f53b5bc58a fwd="181.95.179.168,162.158.123.96" dyno=web.1 connect=0ms service=662ms status=101 bytes=175 protocol=http

UPDATE

这个问题似乎与meteor包browser-policy有关 . 在meteor包文件中禁用它并删除启动代码后,站点停止重定向 .

browser-policy的启动代码如下:

import _ from 'lodash';
import { BrowserPolicy } from 'meteor/browser-policy-common';

BrowserPolicy.framing.disallow();
BrowserPolicy.content.disallowInlineScripts();
BrowserPolicy.content.allowInlineStyles();
BrowserPolicy.content.disallowEval();

const trusted = [
  'maps.googleapis.com',
  'maps.gstatic.com',
  'csi.gstatic.com',
  'dinamo-server-meteor.herokuapp.com',
  'dinamoapp.playtime.com.ar',
  'fonts.googleapis.com',
  'fonts.gstatic.com',
  'cdnjs.cloudflare.com',
  'unpkg.com',
  'a.tile.openstreetmap.org',
  'b.tile.openstreetmap.org',
  'c.tile.openstreetmap.org',
  'blob:',
];

_.map(trusted, origin => BrowserPolicy.content.allowOriginForAll(origin));