gpt4 book ai didi

ruby-on-rails-3 - 配置 ssl 时 Ajax 弹出窗口未加载

转载 作者:太空宇宙 更新时间:2023-11-03 13:42:08 25 4
gpt4 key购买 nike

我正在使用 Ruby on Rails,使用 nginx 作为 Web 服务器,使用 unicorn 作为应用程序服务器。我尝试为我的应用程序配置 ssl,它运行良好。我使用的 nginx 配置如下。

upstream unicorn_domain {
# This is the socket we configured in unicorn.rb
server unix:/home/ubuntu/root_path/tmp/sockets/unicorn.sock fail_timeout=30;
}
server {
listen 80;
server_name demo.domain.com;
rewrite ^ https://demo.domain.com$request_uri? permanent;
}
server {
listen 443 ssl;
client_max_body_size 4G;
server_name demo.domain.com;
ssl on;
ssl_certificate /etc/nginx/ssl/example.com_chain.pem;
ssl_certificate_key /etc/nginx/ssl/example.com.key;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers ALL:-ADH:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP;
ssl_session_cache shared:SSL:10m;


keepalive_timeout 5;

# Location of our static files
root /home/ubuntu/root_path/public;
access_log /home/ubuntu/root_path/log/nginx/nginx.access.log;
location / {


proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;

# If you don't find the filename in the static files
# Then request it from the unicorn server
if (!-f $request_filename) {
proxy_pass https://unicorn_domain;
break;
}

if ($request_uri ~* "\.(ico|css|js|gif|jpe?g|png)\?[0-9]+$") {
expires max;
break;
}

}
}

但是我的应用程序的主页主要是使用 javascript 构建的,它有多个按钮,可以通过单击操作弹出包含一些表单的 ajax 窗口。问题来了。当我们为站点配置 ssl 时,窗口没有弹出。它只发生在主页上。在内部页面中,该功能正在运行。任何人都可以帮助我找到解决方案。

谢谢你,问候

最佳答案

轨道 4 ( http://edgeguides.rubyonrails.org/security.html#default-headers )

config/application.rb 中:

config.action_dispatch.default_headers.merge!({
'Access-Control-Allow-Origin' => '*',
'Access-Control-Request-Method' => '*'
})

关于ruby-on-rails-3 - 配置 ssl 时 Ajax 弹出窗口未加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16439667/

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