目标:
使用App Engine开发服务器减少开发 – 反馈周期.
对于我的使用,这必须作为公共HTTPS地址提供. App Engine开发服务器仅支持HTTP.
这该怎么做:
使用ngrok将本地开发环境公开为https公开可用地址.
使用从https到http的Nginx反向代理.
这似乎是可能的,但对于我的生活,我没有配置工作.
我在osx上使用App Engine Standard Java.
欢迎其他工作解决方案或想法.当然有办法做到这一点.
最佳答案
我使用Nginx作为我的项目https://debtstracker.io/的自签名证书的代理
这是我的Nginx配置.您还需要将一些yourproject.local记录添加到hosts文件中.
server { # This servers dynamic content of DebtsTracker.io project over HTTPS
listen 443;
server_name debtstracker.local;
ssl on;
ssl_certificate /etc/ssl/certs/debtstracker-local.crt;
ssl_certificate_key /etc/ssl/private/debtstracker-local.key;
location /app/ {
proxy_pass http://localhost:8100/;
proxy_set_header Host $http_host;
}
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $http_host;
}
}
第一个位置是GAE devserver,第二个位置是Ionic项目.
#!/usr/bin/env bash
# https://www.accuweaver.com/2014/09/19/make-chrome-accept-a-self-signed-certificate-on-osx/
# https://gist.github.com/jessedearing/2351836
# Run using "sudo"
echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -des3 -out debtstracker-local.key 1024
echo "Generating a Certificate Signing Request..."
openssl req -new -key debtstracker-local.key -out debtstracker-local.csr
echo "Removing pass-phrase from key (for Nginx)..."
cp debtstracker-local.key debtstracker-local.key.org
openssl rsa -in debtstracker-local.key.org -out debtstracker-local.key
rm debtstracker-local.key.org
echo "Generating certificate..."
openssl x509 -req -days 365 -in debtstracker-local.csr -signkey debtstracker-local.key -out debtstracker-local.crt
echo "Copying certificate (debtstracker-local.crt) to /etc/ssl/certs/"
mkdir -p /etc/ssl/certs
cp debtstracker-local.crt /etc/ssl/certs/
echo "Copying key (debtstracker-local.key) to /etc/ssl/private/"
mkdir -p /etc/ssl/private
cp debtstracker-local.key /etc/ssl/private/
希望这可以帮助.我花了一些时间来设置它.