2015-09-11 72 views
0

我們在WPEngine上啓用了SSL的網站,因此每個網頁都通過https服務。SSL證書WPEngine Heroku Rails

我們最近切換到Heroku上的Ruby on Rails。現在我們有一些錯誤顯示出來,當我們使用https:

Your connection is not private 
Attackers might be trying to steal your information from myapp.com (for example, passwords, messages, or credit cards). NET::ERR_CERT_COMMON_NAME_INVALID 

當我都爲我的自定義域或herokuapp域做一個curl檢查,SSL驗證。

curl -kvI https://myapp.herokuapp.com 
# SSL certificate verify ok. 
curl -kvI https://myapp.com 
# SSL certificate verify ok. 

在Chrome中的錯誤是:

This server could not prove that it is myapp.com; its security certificate is from *.herokuapp.com. This may be caused by a misconfiguration or an attacker intercepting your connection. 

在我production.rb我:

config.force_ssl = true 

回答

0

我們有同樣的問題與我們的Java應用程序前一陣子。我可能是錯的,但是Heroku PaaS的dynos後面有他們的雲代理,默認覆蓋了請求頭(在我們的例子中是從https到http)。我想你可能有興趣檢查X-Forwarded-For標題。我們的解決方案是在Procfile中明確傳遞請求上下文參數。

Procfile應該包含這樣的(用於Java): ..--context-xml <contextWithHeaderOptions>..

實際context.xml

<Context> 
    <Valve className="org.apache.catalina.valves.RemoteIpValve" remoteIpHeader="x-forwarded-for" protocolHeader="x-forwarded-proto" portHeader="x-forwarded-port"/> 
</Context>