5 Replies Latest reply on Oct 11, 2018 6:55 PM by Darragh

    Specifing the base URL for links or using relative links

    Patrick Jolliffe

      We are using nginx as reverse proxy in front of ORDS running on Tomcat to convert http requests to https.

      Developers are complaining that links within JSON responses are not taking this into account.

      For example the following handler:

          p_module_name    => 'patmod',
          p_pattern        => 'dual/',
          p_method         => 'GET',
          p_source_type    => ORDS.source_type_collection_feed,
          p_source         => 'SELECT dummy FROM dual',
          p_items_per_page => 0);

      When I go to the URL, https://ords.server/ords/db/patrick/patmod/dual/ I get the following response:

          "items": [
                  "dummy": "X"
          "hasMore": false,
          "limit": 0,
          "offset": 0,
          "count": 1,
          "links": [
                  "rel": "self",
                  "href": "http://ords.server/ords/db/patrick/patmod/dual/"
                  "rel": "describedby",
                  "href": "http://ords.server/ords/db/patrick/metadata-catalog/patmod/dual/"

      I understand that this is due to ORDS not knowing about the reverse-proxy taking place down-stream.

      I've implemented a solution in nginx using ngx_http_sub_module module to rewrite the contents of the response on the fly (ie convert every occurrence http://ords to https://ords).

         location /ords {
            sub_filter_types       application/json;
            sub_filter             'http://ords.lfuat.net:8443'  'https://ords.lfuat.net:8443';
            sub_filter_once        off;

      Is there a better way, maybe to either force these links to be created relative to current URL?  Or somehow specify the base URL to be https://ords.server?


      Message was edited by: Patrick Jolliffe