2015-10-09 15 views

回答

3

我通过specifing标题为部分解决了我的问题我的虚拟主机配置

<VirtualHost *:443> 
    RequestHeader set X-Forwarded-Proto "https" 
    ProxyPreserveHost On 
    ServerName www.example.com 

    SSLEngine On 
    SSLCertificateFile /etc/apache2/ssl/server.crt 
    SSLCertificateKeyFile /etc/apache2/ssl/server.key 

    <Location/> 
     SSLRequireSSL 
    </Location> 

    ProxyPass/http://127.0.0.1:9000/ 
    ProxyPassReverse/http://127.0.0.1:9000/ 
</VirtualHost> 
+0

这真的帮助我了!非常感谢!一个注意事项:如果你实现这个,不要忘记导入mod_headers.so模块 –

1

这里有一种方法,通过ControllerLinkBuilder

Link selfLink = new Link(ControllerLinkBuilder.linkTo(methodOn(Mycontroller.class).someMethod()).toUriComponentsBuilder().scheme("https").build().toUriString(), Link.REL_SELF); 

这应该产生一个Link与自我rel和以下形式的URI:https://host:port/contextroot/pathtocontrollermethod

+0

感谢但我该如何使用withSelfRel()和withRel()与此方法? –

+0

如果您需要访问'UriComponentsBuilder',则认为它不可能使用这些便捷方法,但更新的答案显示手动创建'Link'无论如何。 –