Что-то не так в настройках https веб-упаковщика и nginx - PullRequest
0 голосов
/ 28 января 2020

Я установил https с помощью nginx в Debian (Docker & Kubernetes).

Так что я могу получить доступ к сайту по адресу https, и некоторые части моего сайта работают правильно.

Но проблема в том, что есть сообщение об ошибке

「GET https://localhost: 3035 / sock js -node / info? T = 1580205045081 net :: ERR_SSL_PROTOCOL_ERROR」

вот так и некоторые функции моего сервиса не работают.

Итак, я проверил файлы журналов моего модуля kubernetes, rails и nginx, и это было ясно.

Я думаю, что в моем веб-пакере может быть что-то не так для vue. js

потому что порт веб-упаковщика 3035.

Однако я не знаю, где внести изменения или где проверить журналы.

Кроме того, я Не понимаю, откуда поступил запрос https://localhost: 3035 / socket js -node / ****.

Я прикрепил свой webpacker.yaml и nginx .conf ,

Пожалуйста, дайте мне знать, если есть другие файлы, которые мне нужно прикрепить.

webpacker.yml

# Note: You must restart bin/webpack-dev-server for changes to take effect

default: &default
  source_path: app/javascript
  source_entry_path: packs
  public_root_path: public
  public_output_path: packs
  cache_path: tmp/cache/webpacker
  check_yarn_integrity: false
  webpack_compile_output: false

  # Additional paths webpack should lookup modules
  # ['app/assets', 'engine/foo/app/assets']
  resolved_paths: []

  # Reload manifest.json on all requests so we reload latest compiled packs
  cache_manifest: false

  # Extract and emit a css file
  extract_css: false

  static_assets_extensions:
    - .jpg
    - .jpeg
    - .png
    - .gif
    - .tiff
    - .ico
    - .svg
    - .eot
    - .otf
    - .ttf
    - .woff
    - .woff2

  extensions:
    - .vue
    - .mjs
    - .js
    - .sass
    - .scss
    - .css
    - .module.sass
    - .module.scss
    - .module.css
    - .png
    - .svg
    - .gif
    - .jpeg
    - .jpg

development:
  <<: *default
  compile: true

  # Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules
  check_yarn_integrity: false

  # Reference: https://webpack.js.org/configuration/dev-server/
  dev_server:
    <<: *default
    # https: false
    # host: localhost
    # port: 3035
    # public: localhost:3035
    # hmr: false
    # # Inline should be set to true if using HMR
    # inline: true
    # overlay: true
    # compress: true
    # disable_host_check: true
    # use_local_ip: true
    # quiet: false
    # headers:
    #   'Access-Control-Allow-Origin': '*'
    # watch_options:
    #   ignored: '**/node_modules/**'


test:
  <<: *default
  compile: true

  # Compile test packs to a separate directory
  public_output_path: packs-test
  check_yarn_integrity: false

production:
  <<: *default

  # Production depends on precompilation of packs prior to booting for performance.
  compile: false

  # Extract and emit a css file
  extract_css: true

  # Cache manifest.json for performance
  cache_manifest: true

  check_yarn_integrity: false

nginx .conf

upstream line_manager {
  server unix:///line_manager/tmp/sockets/puma.sock;
}

server {
  if ($host = fullout-csd){
    return 301 https://$host$request_uri;
    return 302 https://$host$request_uri;
    return 304 https://$host$request_uri;
  }
  listen 80;
  server_name fullout-csd.com;
  access_log /var/log/nginx/access.log;
  error_log  /var/log/nginx/error.log;
  root /line_manager/public;

  location /sockjs-node/ {
    proxy_pass http://line_manager;
    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header  X-Forwarded-Proto $scheme;
    proxy_set_header  X-Forwarded-Ssl on; # Optional
    proxy_set_header  X-Forwarded-Port $server_port;
    proxy_set_header  X-Forwarded-Host $host;
  }
}

server {
  listen 443 ssl;
  listen [::]:443 ssl;
  server_name fullout-csd.com;

  access_log /var/log/nginx/access.log;
  error_log  /var/log/nginx/error.log;

  root /line_manager/public;

  ssl_certificate /line_manager/tmp/sockets/fullchain.pem;
  ssl_certificate_key /line_manager/tmp/sockets/privkey.pem;

  client_max_body_size 100m;
  try_files  $uri/index.html $uri @line_manager;
  keepalive_timeout 30;

  location @line_manager {
    proxy_pass http://line_manager;
    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header  X-Forwarded-Proto $scheme;
    proxy_set_header  X-Forwarded-Ssl on; # Optional
    proxy_set_header  X-Forwarded-Port $server_port;
    proxy_set_header  X-Forwarded-Host $host;
  }
}
...