使用https负载均衡器验证aws上的JWT令牌

时间:2016-06-27 16:00:47

标签: amazon-web-services amazon-ec2 asp.net-core jwt openiddict

我正在使用 aws(亚马逊网络服务)来托管我的应用。我的托管服务器没有安装SSL,但负载均衡器(面向互联网的网关)具有SSL,因此每当我拨打server { listen 80; server_name domain.com www.domain.com; rewrite ^ https://$server_name$request_uri? permanent; } server { listen 443; server_name domain.com www.domain.com; ssl on; ssl_certificate /sslpath/domain.com.crt; ssl_certificate_key /sslpath/domain.com.key; ssl_session_timeout 30m; root /webrootpath/domain.com; index index.php; location / { index index.html index.php; try_files $uri $uri/ @handler; expires 30d; } location @wp { rewrite ^/blogpath(.*) /blogpath/index.php?q=$1; } location ^~ /blogpath { root /webrootpath/domain.com; index index.php index.html index.htm; try_files $uri $uri/ @wp; location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_pass 127.0.0.1:9000; } } location ~ ^/(app|includes|lib|media/downloadable|pkginfo|report/config.xml|var)/ { internal; } location /var/export/ { internal; } location /. { return 404; } location @handler { rewrite / /index.php; } location ~* .php/ { rewrite ^(.*.php)/ $1 last; } location ~* .php$ { if (!-e $request_filename) { rewrite / /index.php last; } expires off; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param MAGE_RUN_CODE default; fastcgi_param MAGE_RUN_TYPE store; include fastcgi_params; } error_log /data/log/nginx/domain.com_error.log; access_log /data/log/nginx/domain.com_access.log; } 时,它首先进入负载均衡器,然后进入https:// mydomain .com

然而,这种体系结构的问题是当服务器创建一个令牌时它具有颁发者http:// mydomain .com,所以在http:// mydomain .com配置中,如果我将jwtbeaererauthentication作为权限,它会抛出CORS错误,如果我放{ {1}}它不会授权。

如果有任何此类问题的解决方法,请告诉我们。我使用 asp.net核心,openiddict和jwtauthentication 作为中间件。

0 个答案:

没有答案