Forum Stats

  • 3,815,377 Users
  • 2,259,010 Discussions
  • 7,893,063 Comments

Discussions

ORDS 22.1 path mapping

jariola
jariola Member Posts: 10,735 Silver Crown

Is there possibility in ORDS 22.1 configure paths for one pool so that it serves default path /ords and another path e.g. /ords/mypath?

In previous version this was possible using url-mapping.xml like

<pool-config xmlns="http://xmlns.oracle.com/apex/pool-config">
  <pool name="my_db" base-path="/" />
  <pool name="my_db" base-path="/mypath" />
</pool-config>

When using ORDS 22.1 and entering to pool paths file below lines, pool serves only default path /ords

/
/mypath


Best Answer

  • Gerardo Gomez-Oracle
    Gerardo Gomez-Oracle Member Posts: 4 Employee

    You can get it working the way you want by doing the following:

    1. Rename your pool folder /databases/my_db folder to default /databases/default. This indicates that this pool will serve /ords/ requests.
    2. Remove the '/' from the paths file, leave it with /mypath only, so it also serves /ords/mypath requests

    /databases/default/paths

    /mypath 
    

    3. Restart ORDS

Answers

  • thatJeffSmith-Oracle
    thatJeffSmith-Oracle Distinguished Product Manager Posts: 8,510 Employee

    Yes, add a file in your databases/pool directory called

    hostnames (no file suffix, just literally, 'hostnames' and/or

    paths

    In those files, have on a single line, a comma delimited list of patterns or URLs

    See Docs

    jariola
  • jariola
    jariola Member Posts: 10,735 Silver Crown

    Thanks Jeff,

    Maybe I misunderstand something. I did understand from document you point me that list of patterns should be separated by new line.

    When I place below to file "../databases/my_db/paths"

    /,/mypath
    

    I get below error in Tomcat logs and ORDS not working

    SEVERE [oracle.dbtools.common.logging.JDKLogSink record] Error parsing pattern, reason: Expected one of: <<literal>> but got: <<,>>

    And if I place to same file

    /
    /mypath
    

    ORDS is working but I get HTTP 404 error when try access APEX from url

    https://127.0.0.1/ords/mypath/apex

    I can access APEX from

    https://127.0.0.1/ords/apex

    In previous version both URLs did work using url-mapping.xml I showed in previous post

  • thatJeffSmith-Oracle
    thatJeffSmith-Oracle Distinguished Product Manager Posts: 8,510 Employee

    When you migrated, your mapping patterns should have come over for you, and your URLs/routes should have continued to work. 

    Are you saying this didn't happen? For an existing, working install of ORDS 21.4 - going to 22.1, those files and entries should be setup for you by the migrate/install process.

    jariola
  • jariola
    jariola Member Posts: 10,735 Silver Crown

    I didn't run migration. I did install ORDS 22.1 from scratch.

    I can try migration, and see what it does.

    Thanks.

  • jariola
    jariola Member Posts: 10,735 Silver Crown
    edited Apr 25, 2022 3:17PM

    It seems migration don't like my old ORDS url-mapping.xml 

    The url mapping for pool name my_db has an invalid base-path pattern: /
    

    Full output

    $ export ORDS_CONFIG=/tmp/ords_latest_config
    $ ./bin/ords migrate config /tmp/old_ords_config/
    
    
    ORDS: Release 22.1 Production on Mon Apr 25 15:07:33 2022
    
    
    Copyright (c) 2010, 2022, Oracle.
    
    
    Configuration:
      /tmp/ords_latest_config
    
    
    Oracle REST Data Services - Migrate Configuration
    Oracle REST Data Services 22.1.0.r1051723 - Migrate Configuration 
    Migrating ORDS Configuration files located at /tmp/old_ords_config/ords
    File /tmp/old_ords_config/ords/standalone/standalone.properties does not exist.
    The global setting named: db.invalidPoolTimeout was set to: 5m
    The global setting named: plsql.gateway.mode was set to: proxied
    The global setting named: security.requestValidationFunction was set to: wwv_flow_epg_include_modules.authorize
    The setting named: db.username was set to: ORDS_PUBLIC_USER2 in configuration: my_db
    The setting named: db.wallet.zip.path was set to: /tmp/Wallet_MYDB.zip in configuration: my_db
    The setting named: db.wallet.zip.service was set to: mydb_low in configuration: my_db
    The setting named: jdbc.InactivityTimeout was set to: 120 in configuration: my_db
    The setting named: jdbc.InitialLimit was set to: 3 in configuration: my_db
    The setting named: jdbc.MaxLimit was set to: 5 in configuration: my_db
    The setting named: jdbc.MinLimit was set to: 0 in configuration: my_db
    The setting named: jdbc.statementTimeout was set to: 90 in configuration: my_db
    The url mapping for pool name my_db has an invalid base-path pattern: /
    Legacy configuration files located at /tmp/old_ords_config/ords are no longer being used to configure ORDS or its connection pools.  Your migrated configuration files are now located at /tmp/ords_latest_config 
    


  • thatJeffSmith-Oracle
    thatJeffSmith-Oracle Distinguished Product Manager Posts: 8,510 Employee

    What version of ORDS are you currently using?

    What is your use case to have both / and /something_else mapped to the same database/pool/apex ?

    Jeff

    jariola
  • jariola
    jariola Member Posts: 10,735 Silver Crown
    edited Apr 25, 2022 4:48PM

    I have used long time and in many previous ORDS version that url-mapping.xml. Latest version where I used it was 21.4.2.062.1806.

    Use case is host applications in URL

    https://127.0.0.1/ords/

    Web server adds HTTP header e.g. x-public_url when using that URL and I restrict access to APEX builder by that using APEX instance parameter RESTRICT_DEV_HEADER.

    And have another URL where I can access to APEX builder, and web server don't set that HTTP header

    https://127.0.0.1/ords/mysecreturlprefix/


    And another use case is add some extra authentication in web server side to URL that can access to APEX builder

    Paavo
  • Gerardo Gomez-Oracle
    Gerardo Gomez-Oracle Member Posts: 4 Employee

    You can get it working the way you want by doing the following:

    1. Rename your pool folder /databases/my_db folder to default /databases/default. This indicates that this pool will serve /ords/ requests.
    2. Remove the '/' from the paths file, leave it with /mypath only, so it also serves /ords/mypath requests

    /databases/default/paths

    /mypath 
    

    3. Restart ORDS

  • jariola
    jariola Member Posts: 10,735 Silver Crown

    Thank you. That works.