我的应用在 Google Compute Engine 上运行。Nginx 用作代理服务器。Nginx 被配置为使用 SSL。以下是 /etc/nginx/sites-available/default 的内容:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name mywebapp.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
include snippets/ssl-mywebapp.com.conf;
include snippets/ssl-params.conf;
root /home/me/MyWebApp/wwwroot;
location /.well-known/ {
}
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
在 Startup.cs 我有:
app.UseGoogleAuthentication(new GoogleOptions()
{
ClientId = Configuration["Authentication:Google:ClientId"],
ClientSecret = Configuration["Authentication:Google:ClientSecret"],
});
现在在 Google Cloud Platform 中,我需要指定授权重定向 URI。如果我输入以下内容,我的 Web 应用程序将按预期工作:
http://mywebapp.com/signin-google
但是,如果使用它将不起作用https
;浏览器显示以下错误:
The redirect URI in the request, http://mywebapp.com/signin-google, does
not match the ones authorized for the OAuth client.
在这种情况下,使用 http 作为授权重定向 uri 是否安全?如果我希望它是 https,我需要什么配置?