cube icon indicating copy to clipboard operation
cube copied to clipboard

Allow to set basePath of the REST API to '/'

Open slatkovic opened this issue 3 months ago • 2 comments

Describe the bug Setting basePath in cube.js to / results in 404 across all API endpoints

To Reproduce Steps to reproduce the behavior:

  1. Create a cube.js fils
  2. Set basePath: '/'
  3. Try accessing the API at [base host]/v1/meta
  4. Receive a 404

Expected behavior The API should be accessible at [base host]/v1/meta

Version: v0.35.1

Additional context Setting the basePath to a different value, e.g. /test results in proper behavior ([base host]/test/v1/meta returns 200)

slatkovic avatar Mar 20 '24 04:03 slatkovic

I was able to confirm this behavior.

@slatkovic Could you please describe your use case? Why would you like to have an empty base path?

BTW, as a workaround, you can (and probably should) put Cube behind a reverse proxy if you're self-hosting.

igorlukanin avatar Mar 20 '24 14:03 igorlukanin

@igorlukanin, we have an API gateway set up to interface with Cube at (an example URL of) https://api.domain.com/cube.

Currently, our configuration uses /api as the basePath, placing the meta endpoint at https://api.domain.com/cube/api/v1/meta. Ideally, we'd like to reconfigure this so the endpoint is directly accessible under https://api.domain.com/cube/v1/meta instead.

slatkovic avatar Mar 20 '24 17:03 slatkovic