【发布时间】:2014-07-22 15:37:22
【问题描述】:
我正在尝试向互联网公开 neo4j 数据库。
出于安全原因,我想通过 nginx 将其隐藏在 SSL/basic_auth 组合后面。下面是对应的nginx配置:
location /neo4j/ {
proxy_pass https://localhost:7473/;
proxy_read_timeout 600;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X_FORWARDED_PROTO https;
proxy_set_header Host $http_host;
proxy_buffering off;
proxy_redirect off;
auth_basic "restricted";
auth_basic_user_file /etc/nginx/auth/htpasswd;
proxy_headers_hash_max_size 1024;
proxy_headers_hash_bucket_size 128;
proxy_ssl_session_reuse off;
rewrite /neo4j/(.*) /$1 break;
}
虽然我可以访问 https://example.com/neo4j/browser,但网络界面告诉我,它无法连接到 neo4j,并且我的网络浏览器控制台被 OPTIONS https://example.com/db/data 405(Not allowed) 填满
我还尝试了结合身份验证扩展 (https://github.com/neo4j-contrib/authentication-extension) 的 https 服务器内置 neo4j。 使用此选项,我还可以访问 Web 界面。
但界面也显示,它无法连接到 neo4j 并且 webbrowser 的控制台被 OPTIONS http://example.com:7473/db/data/ net::ERR_EMPTY_RESPONSE 和提示 The page at 'https://example.com:7473/browser/' was loaded over HTTPS, but displayed insecure content from 'http://example.com:7473/db/data/': this content should also be loaded over HTTPS. 填满
有谁知道,如何让它工作?非常感谢!
【问题讨论】:
-
不是答案,而是相关的:请参阅github.com/sarmbruster/vagrant_neo4j_modproxy 以获取使用 apache 的 mod_proxy + mod_substitute 的示例配置。有趣的行是github.com/sarmbruster/vagrant_neo4j_modproxy/blob/master/etc/…。所以需要修改http响应中的一些内容。
-
谢谢!这就是我试图通过 nginx 配置中的 rewrite 指令实现的目标......虽然不起作用:(
标签: ssl nginx proxy neo4j reverse-proxy