我使用HATEOAS作为https后面的REST API,但链接保留在http。
"links": [
{
"rel": "self",
"href": "http://..."
},
{
"rel": "object",
"href": "..."
}
]
是否可以将HATEOAS配置为指向我的https?
答案 0 :(得分:4)
我通过将标头指定为虚拟主机配置的一部分来解决我的问题
<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>