2015-10-09 16 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'無論如何。 –