Nginx запускает Java-приложение от имени root, используя cloudflare ssl - PullRequest
0 голосов
/ 10 октября 2019

Я использую метабазу с nginx со следующей конфигурацией: /etc/nginx/sites-available/example.com

server {

    # SSL configuration

    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    ssl        on;
    ssl_certificate         /etc/ssl/certs/cert.pem;
    ssl_certificate_key     /etc/ssl/private/key.pem;
    ssl_client_certificate /etc/ssl/certs/cloudflare.crt;
    ssl_verify_client on;
    server_name example.com www.example.com;

    root /var/www/example.com/html;
    index index.html index.htm index.nginx-debian.html;

    location / {
    proxy_pass http://127.0.0.1:3000/;
    }   
}

Это работает с Cloudflare с настройками Full и Full(strict), имеющими Always Use HTTPSи Automatic HTTPS Rewrites оба ON и Rocket Loader™ OFF

Если я попытаюсь запустить proxy_pass в некорневой папке, например

   location /metabase/ 
        {
        proxy_pass http://127.0.0.1:3000/;
        }

Я получаю (в консоли Firefox):

The resource from “https://example.com/app/dist/app-main.bundle.css?4ccd5c23fd3dcf61a206fe52be657d90” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).

The resource from “https://example.com/app/dist/styles.bundle.css?dcf6d19a625c0113333c2f87a9aaef16” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).

The resource from “https://example.com/app/dist/styles.bundle.js?3f8f0db4d958de85c2e9” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).

The resource from “https://example.com/app/dist/vendor.bundle.js?3f8f0db4d958de85c2e9” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).

В консоли Chrome

Refused to apply style from 'https://example.com/app/dist/vendor.bundle.css?69e4c60679defb49c969e3d7051532f1' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled
....

И страница пуста, потому что не загружена таблица стилей или JavaScript: (.

Там есть решение аналогичной проблемы, но оно на apache. Есть ли что-то похожее на nginx?

Не знаю точно, если это проблема nginx илиCloudflare или их комбинация.

...