Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using spring-HATEOAS behind Secure protocol https

I'm using HATEOAS for my REST API which is behind https, but link stay in http.

"links": [
      {
        "rel": "self",
        "href": "http://..."
      },
      {
        "rel": "object",
        "href": "..."
      }
    ]

Is it possible to config HATEOAS to point on my https ?

like image 794
biology.info Avatar asked Dec 07 '25 02:12

biology.info


1 Answers

I resolved my problem by specifing the header as part of my virtual host configuration

<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>
like image 119
biology.info Avatar answered Dec 08 '25 14:12

biology.info



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!