Nginx Ingressロードバランサを実装して、GCPにPortusをデプロイします。アプリケーションを使用して、私は次のエラーを取得する形態のいくつかを記入しようとしたときポルトゥスだけで罰金をアップロードしますが:混在したコンテンツのエラーnginx in kubernetes in rails app
VM798:1 Mixed Content: The page at ' https://staging.foo.bar/admin/registries/new ' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ' http://staging.foo.bar//api/v1/registries/validate?name=devreg&hostname=staging-foo-barregistry%3A5000&external_hostname=&use_ssl=false&force=false&only%5B%5D=hostname '. This request has been blocked; the content must be served over HTTPS.
環境:
- KubernetesでGCP
- すべてのリソースがヘルムを通じて展開されています
- sslはkube-legoによって提供されています 次のようにブドウのAPI宝石と
- のRailsアプリ
- ブドウは、APIをマウント:
mount API::RootAPI => "/"
だから私は手動でHTTP呼び出しのためのコードを確認してください作ったと何も表示されませんでした。そして、私は今、いくつかのアプリケーションが正しくSSLを使ってロードされ、APIが同じルールに従わないようにするために、rails docsとnginx docsを調べようとしました。
-----アップデート1 ------ さらに調査すると、Vueバリデータと関係があるように見えます。
curl ' http://staging.foo.bar//api/v1/registries/validate?name=devreg&hostname=st&external_hostname=&use_ssl=false&force=false&only%5B%5D=name ' -X OPTIONS -H 'Access-Control-Request-Method: GET' -H 'Origin: https://staging.foo.bar ' -H 'Access-Control-Request-Headers: x-csrf-token' --compressed
をそして、それはルートURLがここで呼び出されているように見えます:上記のように
javascript:
window.API_ROOT_URL = '#{root_url}';
root_urlは/に設定されている開発ツールをチェックすると、以下のことが明らかになりました。しかし
、Vueのコード近い凝るを分析:
Vue.http.options.root = window.API_ROOT_URL;
Vue.http.interceptors.push((_request, next) => {
window.$.active = window.$.active || 0;
window.$.active += 1;
next(() => {
window.$.active -= 1;
});
});
Vue.http.interceptors.push((request, next) => {
if ($.rails) {
// eslint-disable-next-line no-param-reassign
request.headers.set('X-CSRF-Token', $.rails.csrfToken());
}
next();
});
// we are not a SPA and when user clicks on back/forward
// we want the page to be fully reloaded to take advantage of
// the url query params state
window.onpopstate = function (e) {
// phantomjs seems to trigger an oppopstate event
// when visiting pages, e.state is always null and
// in our component we set an empty string
if (e.state !== null) {
window.location.reload();
}
};
Vue.config.productionTip = process.env.NODE_ENV !== 'production';
のparamsは、私はあなたのアプリケーションがどのように機能するかについてはよく分からない、とメカニッククエリ
params do
requires :name,
using: API::Entities::Registries.documentation.slice(:name)
requires :hostname,
using: API::Entities::Registries.documentation.slice(:hostname)
optional :external_hostname,
using: API::Entities::Registries.documentation.slice(:external_hostname)
requires :use_ssl,
using: API::Entities::Registries.documentation.slice(:use_ssl)
optional :only, type: Array[String]
end
use_sslがparamsで呼び出されていますが、まだ動作したくないようです – niharvey