2015-11-16 52 views
0
{ "_links" : { 
    "orders" : { 
     "href" : "http://localhost:8080/orders" 
    }, 
    "profile" : { 
     "href" : "http://localhost:8080/api/alps" 
    } 
    } 
} 

此結果由Springboot Rest Data生成。我打算把這個應用程序放在Nginx的後面,聽聽安全端口(443)。即使我的應用程序仍在8080上運行,如何將_links端口從8080更改爲443?更改默認Springboot其餘數據默認鏈接

回答

0

spring引導數據休息會從請求讀取主機和方案作爲基礎url,所以你應該告訴spring引導真正的主機和方案。 這個nginx配置適用於我:

location /api/ { 
     proxy_pass http://localhost:8080/; 
     proxy_set_header Host $host; 
     proxy_set_header X-Forwarded-Proto $scheme; 
     proxy_set_header X-forwarded-Prefix /api; 
}