gpt4 book ai didi

apache - 422 不可处理的实体,JS 文件,gitlab 8.17,apache ssl

转载 作者:太空宇宙 更新时间:2023-11-03 12:49:30 28 4
gpt4 key购买 nike

昨天在 ubuntu 16.04 安装上安装了一个新的 gitlab 8.17.0,并像我记录的旧版本一样配置它。我正在运行一个让加密作为代理的 apache2。看起来好像一切都运行良好,但是没有加载一些 JS 文件。我在 https 处得到“422 无法处理的实体”

  • 域/ Assets /webpack/application-XXX.js
  • 域/ Assets /webpack/lib_dX.js
  • domain/assets/webpack/users-X.js
  • 域/ Assets /webpack/lib_d3-X.js
  • domain/assets/webpack/users-X.js

/etc/gitlab/gitlab.rb

external_url 'https://gitlab.example.com'

nginx['listen_address'] = 'localhost'
nginx['listen_port'] = 8080
nginx['listen_https'] = false

web_server['external_users'] = ['www-data']
nginx['enable'] = false

/etc/apache2/sites-available/gitlab.example.com.conf

<VirtualHost *:80>
ServerName gitlab.example.com
ServerAdmin mail@gitlab.example.com

ErrorLog /var/log/apache2/gitlab.example.com/error.log
CustomLog /var/log/apache2/gitlab.example.com/access.log combined

Redirect 301 / https://gitlab.example.com/
</VirtualHost>

<VirtualHost *:443>
ServerName gitlab.example.com
ServerAdmin mail@gitlab.example.com

ErrorLog /var/log/apache2/gitlab.example.com/error.log
CustomLog /var/log/apache2/gitlab.example.com/access.log combined

RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"
ProxyPreserveHost On
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/

SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/gitlab.example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/gitlab.example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/gitlab.example.com/chain.pem

<Proxy http://localhost:8080/>
Order deny,allow
Allow from all
</Proxy>
</VirtualHost>

有没有人有解决问题的想法?

谢谢!祝你有个愉快的星期天。

最佳答案

我在提供提到的静态文件时遇到了同样的问题,但在 nginx 代理之后。在 /var/log/gitlab/gitlab-rails/production.log 文件中有错误:

Started GET "/assets/webpack/application-0b895f7016d93748393a-v2.js" for 127.0.0.1 at 2017-03-05 11:14:21 +0100
Processing by ApplicationController#route_not_found as JS
Parameters: {"unmatched_route"=>"assets/webpack/application-0b895f7016d93748393a-v2"}
Security warning: an embedded <script> tag on another site requested protected JavaScript.
If you know what you're doing, go ahead and disable forgery protection on this action to
permit cross-origin JavaScript embedding.
Completed 422 Unprocessable Entity in 28ms (ActiveRecord: 1.8ms)

ActionController::InvalidCrossOriginRequest (Security warning: an embedded
<script> tag on another site requested protected JavaScript. If you know
what you're doing, go ahead and disable forgery protection on this action to
permit cross-origin JavaScript embedding.):
lib/gitlab/middleware/multipart.rb:93:in `call'
lib/gitlab/request_profiler/middleware.rb:14:in `call'
lib/gitlab/middleware/go.rb:16:in `call'

所以我在 /opt/gitlab/embedded/service/gitlab-rails/config/environments/production.rb 中做了更改:

  config.action_controller.allow_forgery_protection = false

# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_files = true

并重新启动 gitlab(gitlab-ctl restart)。现在它可以工作了,但是我想我的服务器的安全性被削弱了。

关于apache - 422 不可处理的实体,JS 文件,gitlab 8.17,apache ssl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42467531/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com