切换到SSL后,angularjs get请求被取消

时间:2013-09-14 15:13:43

标签: rest angularjs ssl

我有几个服务从后端通过我的REST api获取数据。这一切都运行良好,直到我在服务器上启用SSL。

现在请求永远不会到达服务器,chrome网络检查员表示这些请求被“取消”和“待定”

注意前端正在同一个域上运行,并通过ssl。

以防这与我的服务器配置有关,这里是:

worker_processes  auto;

events {
    worker_connections  1024;
}

http {
    include       ${buildout:directory}/parts/nginx/conf/mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  70;

    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;

    server {
        listen      80;
        server_name localhost;
        rewrite     ^   https://$server_name$request_uri? permanent;
    }

    server {
        server_name localhost;
        listen 443;
        access_log  ${logs:access_log};

        ssl on;
        ssl_certificate ${buildout:directory}/dev/server.crt;
        ssl_certificate_key ${buildout:directory}/dev/server.key;

        location ^~ /media/ {
            root ${opts:media_dir};
            expires 31d;
        }

        location ^~ /static/ {
            root ${opts:media_dir};
            expires 31d;
        }

        location / {
            proxy_pass http://unix:${opts:socketfile}:;
            proxy_pass_header Server;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_connect_timeout 10;
            proxy_read_timeout 10;

            proxy_set_header X-Scheme $scheme;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For  $remote_addr;
            # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    }
}

谢谢!

1 个答案:

答案 0 :(得分:0)

问题已解决。事实证明我有一个额外的nginx网络服务器正在运行,每次更新配置时我都会重新启动错误的网络服务器。杀死流氓nginx服务器并重新加载正确的服务器解决了这个问题。