Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java GAE开发服务器的https代理_Java_Google App Engine_Nginx_Https_Proxy - Fatal编程技术网

Java GAE开发服务器的https代理

Java GAE开发服务器的https代理,java,google-app-engine,nginx,https,proxy,Java,Google App Engine,Nginx,Https,Proxy,我正在为GAE开发应用程序。目前GAE dev服务器不支持https,所以我设法使用nginx创建了一个https代理。问题是,我还有一个使用我的应用程序的第三方服务,但只能使用HTTPS发出请求,即它可以发出请求,但不会继续。在我的应用程序中,我使用服务库,该库在内部使用HttpServletRequest中的req.getRequestURL()。因此,请求是:请求(到https://localhost)->nginx代理->请求(到http://localhost)->dev GAE服务器

我正在为GAE开发应用程序。目前GAE dev服务器不支持https,所以我设法使用nginx创建了一个https代理。问题是,我还有一个使用我的应用程序的第三方服务,但只能使用HTTPS发出请求,即它可以发出请求,但不会继续。在我的应用程序中,我使用服务库,该库在内部使用HttpServletRequest中的req.getRequestURL()。因此,请求是:请求(到https://localhost)->nginx代理->请求(到http://localhost)->dev GAE服务器。并且req.getRequestURL()返回“http://localhost”,它与请求字段中的“http://localhost”不匹配(这是服务协议指定的请求中的一个特殊字段),库抛出异常。我能做什么? 我的nginx配置:

 server {       
   listen              443 ssl; # The ssl directive tells NGINX to decrypt 
                                # the traffic
   server_name         localhost;
   ssl_certificate     ls.crt; # This is the certificate file
   ssl_certificate_key ls.key; # This is the private key file
   location / {     
    proxy_pass http://localhost:8080;       
   }
}

nginx应该在头中设置
X-Forwarded-Proto:https
(我猜),服务器可以使用它来确定原始请求(来自客户端)是https。我可以通过req.getHeader(“X-Forwarded-Proto”)查看头,但不幸的是,它对req.getRequestURL()没有影响((您自己也可以进行一些黑客攻击:)或者让作者修复这个“bug”。好吧,我想我发现了一些东西,true是Jetty配置的一个参数(GAE使用Jetty)。我如何通过GAE开发服务器将这个“传输”到Jetty?好吧,好吧,通过使用servlet筛选器+HttpServletRequestWrapper来完成。它很难看,但用于测试目的)nginx应该在头中设置
X-Forwarded-Proto:https
(我猜),服务器可以使用它来确定原始请求(来自客户端)是https。我可以通过req.getHeader(“X-Forwarded-Proto”)查看头,但不幸的是,它对req.getRequestURL()没有影响((您自己也可以进行一些黑客攻击:)或者让作者修复这个“bug”。好吧,我想我发现了一些东西,true是Jetty配置的一个参数(GAE使用Jetty)。我如何通过GAE开发服务器将这个“传输”到Jetty?好吧,好吧,通过使用servlet筛选器+HttpServletRequestWrapper来完成。它很难看,但用于测试目的)nginx应该在头中设置
X-Forwarded-Proto:https
(我猜),服务器可以使用它来确定原始请求(来自客户端)是https。我可以通过req.getHeader(“X-Forwarded-Proto”)查看头,但不幸的是,它对req.getRequestURL()没有影响((您自己也可以进行一些黑客攻击:)或者让作者修复这个“bug”。好吧,我想我发现了一些东西,true是Jetty配置的一个参数(GAE使用Jetty)。我如何通过GAE开发服务器将这个“传输”到Jetty?好吧,好吧,通过使用servlet筛选器+HttpServletRequestWrapper来完成。它很难看,但用于测试目的)