Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sw360-dev] sw360 REST API - nginx X-Forward headers for generated HAL Links

Dear sw360 users,

 

did you hear about the new REST feature?

The RESTful API is now available in sw360 portal application.

 

Please consider the following configuration if you are using nginx and tomcat.

The REST API objects provides self-links to reference to other objects.

These links are realized on Hypertext Application Language (HAL).

 

e.g. 

 

       "_links": {

          "self": {

            "href": "https://localhost:8443/resource/api/projects/065f3aa45c2683297fd1bb39296f519d"

          }

 

The REST spring boot applications are using the Tomcat environment configuration to generate the HAL links.

If the Tomcat is only configured as HTTP, the generated links will contain the HTTP protocol and port.

This will cause some problems if tomcat is used together with nginx which is configured as HTTPS.

 

Setting Nginx http 'X-Forward-*' headers on a reverse proxy

 

location / {

  ...

  proxy_set_header        X-Forwarded-Port   443;

  proxy_set_header        X-Forwarded-Proto  https;

}

 

Kind regards

Thomas Maier

 


Back to the top