将http://example.com:500redirect到https://secured_example.com/admin

我已经通过electron.jsbuild立了桌面应用程序,该应用程序请求http://example.com:5000上的前端服务器,我需要redirect到https://secure_example.com/admin 。 在前台服务器上,我有docker“nginx”和“front”服务,我无法重新安装应用程序。 我需要允许服务“前” http://前:5000将redirecthttp://example.com:5000到https://secure_example.com/admin时可用,但是当我尝试在浏览器中去http: //example.com:5000我被正确地redirect到https://secure_example.com/admin ,但我无法访问该页面。 pm2日志显示:1 | buildAdm | GET / admin 200 6.911 ms

但我需要请求GET / not / admin这是我的nginx.conf:

server { server_name example.com; listen 5000; return 301 https://secure_example/admin$request_uri; } server { server_name secure_example.com; listen 443; ssl on; … location /admin { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Proto https; proxy_read_timeout 30s; proxy_redirect off; proxy_pass http://front:5000; } }