{"action":"created","issue":{"url":"https://api.github.com/repos/directus/app/issues/1172","repository_url":"https://api.github.com/repos/directus/app","labels_url":"https://api.github.com/repos/directus/app/issues/1172/labels{/name}","comments_url":"https://api.github.com/repos/directus/app/issues/1172/comments","events_url":"https://api.github.com/repos/directus/app/issues/1172/events","html_url":"https://github.com/directus/app/issues/1172","id":387895669,"node_id":"MDU6SXNzdWUzODc4OTU2Njk=","number":1172,"title":"Deploy app/api with docker under different base url path prefix","user":{"login":"kmaris","id":15710405,"node_id":"MDQ6VXNlcjE1NzEwNDA1","avatar_url":"https://avatars0.githubusercontent.com/u/15710405?v=4","gravatar_id":"","url":"https://api.github.com/users/kmaris","html_url":"https://github.com/kmaris","followers_url":"https://api.github.com/users/kmaris/followers","following_url":"https://api.github.com/users/kmaris/following{/other_user}","gists_url":"https://api.github.com/users/kmaris/gists{/gist_id}","starred_url":"https://api.github.com/users/kmaris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmaris/subscriptions","organizations_url":"https://api.github.com/users/kmaris/orgs","repos_url":"https://api.github.com/users/kmaris/repos","events_url":"https://api.github.com/users/kmaris/events{/privacy}","received_events_url":"https://api.github.com/users/kmaris/received_events","type":"User","site_admin":false},"labels":[{"id":839560193,"node_id":"MDU6TGFiZWw4Mzk1NjAxOTM=","url":"https://api.github.com/repos/directus/app/labels/bug","name":"bug","color":"c62828","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-12-05T18:51:17Z","updated_at":"2018-12-05T22:22:22Z","closed_at":null,"author_association":"NONE","body":"<!--\r\n1. Do not delete this template or the issue will be closed\r\n2. Ensure you're using the latest version of Directus\r\n3. Post to the correct repo:\r\n    App:  https://github.com/directus/app/issues (YOU ARE HERE)\r\n    API:  https://github.com/directus/api/issues\r\n    Docs: https://github.com/directus/docs/issues\r\n-->\r\n\r\n# Bug Report\r\n\r\nI am trying to deploy the api and app in separate docker containers on the same host. I'd like /directus/ to serve the javascript app (this works) and would like to host the api under /directus-api/ (this deployment also works and I can interact just fine with a request to /directus-api/users?access_token=...).\r\n\r\nI built the docker container for the app as per the directions here: https://docs.directus.io/app/admin/install.html#installation with `docker build . -t directus`. Running the container with `docker run -d -e \"API_URL=http://myhostname.internal.org/directus-api/\"...` did not work and it couldn't find the api. I looked at the entrypoint script and you seem to reference API_ENDPOINT, so I tried adding that too: `docker run -d -e 'API_URL=http://myhostname.internal.org/directus-api/' -e 'API_ENDPOINT=\"directus=http://myhostname.internal.org/directus-api/\"'`\r\n\r\nThe parsing done in entrypoint.sh produces an api entry of api:{ \"\": \"directus\"} which seemed broken to me, manually adding the api url as the key for directus fixes the config issue, but the deployment is still broken.\r\n\r\n## Steps to Reproduce\r\n\r\nHost the app and api under the same hostname and different base url's. The js app seems to get confused sending /server/ping requests to /server/ping instead of /directus-api/server/ping and refuses to let logins happen.\r\n\r\n## Expected Behavior\r\n\r\nThe app talks to the api...\r\n\r\n## Actual Behavior\r\n\r\nThe app does not see the api.\r\n\r\n## Other Context & Screenshots\r\n\r\nSince the default nginx configuration in the docker container only serves from /, I set the load balancer to strip the /directus/ part of the path from app urls. That seems to work fine and assets load. It seems to me that the ping needs to take the hostname and path prefix/base url/router base url/api endpoint/api url/whatever into accout and currently it does not. Trying to allow other api's by specifying a url manually does not work (path prefix is ignored).\r\n\r\nSidenote: I needed to hide the actual hostname but this is all going over port 80 so paths are the real culprit here. I have tried several api variations in the config object with both _ and directus-api names to no avail.\r\n\r\nHappy to provide other deployment details if they would help. Here's config.js:\r\n\r\n    /* eslint-disable */\r\n\r\n    (function directusConfig() {\r\n      const config = {\r\n        // The API URLs the user can connect to using this instance of the application.\r\n        // Object values are used as project name in the app\r\n        // Don't forget to add the API environment!\r\n        api: {\r\n          \"http://myhostname.internal.org/directus-api/\": \"directus\" // manual change\r\n        // original line at container runtime: \"\": \"directus\"\r\n        },\r\n\r\n        // Allow the user to connect to any API by entering a URL in a text field\r\n        //   instead of selecting from a dropdown\r\n        allowOtherAPI: false,\r\n\r\n        // Controls the way the application routes. By default, routing is done using\r\n        //   hashes (#) to ensure the app works without any server url rewrites.\r\n        //\r\n        // If you're using the application and have the correct URL rewrites in place\r\n        //   (everything to /index.html), you can change this to \"history\" to make\r\n        //   the urls in the app a little prettier\r\n        routerMode: \"hash\", // hash | history\r\n\r\n        // When using history mode, the application will make all the routes \"pretty\"\r\n        // by using absolute paths. If you are serving the application from a folder\r\n        // like /admin, this will cause the routes to be wrong (eg /collection instead\r\n        // of /admin/collections). To combat this, set the routerBaseUrl to the path\r\n        // you're serving the application from\r\n        routerBaseUrl: \"/directus\"\r\n      };\r\n\r\n      window.__DirectusConfig__ = config;\r\n    })();\r\n\r\nAnd the environment in the docker container:\r\n\r\n    HOSTNAME=7540c6b91ebb\r\n    SHLVL=1\r\n    HOME=/root\r\n    API_ENDPOINT=directus=http://myhostname.internal.org/directus-api/\r\n    ROUTER_BASE_URL=/directus/\r\n    NGINX_VERSION=1.14.1\r\n    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\r\n    ALLOW_OTHER_API=false\r\n    PWD=/\r\n    API_URL=http://myhostname.internal.org/directus-api/\r\n    ROUTER_MODE=hash\r\n\r\n## Technical Details\r\n\r\n- Device: Desktop\r\n- OS: MacOS 10.13.6\r\n- Browser: Firefox Quantum 63.0.3 (64-bit)\r\n- Directus App: master branch 9cd09ba8b6ef9f9eca66a06f02f5ced77dea80a6\r\n- Directus API: 7.0.8\r\n- Install Method: app: cloned, docker build, docker run. api: cloned tag, docker build, docker run\r\n"},"comment":{"url":"https://api.github.com/repos/directus/app/issues/comments/444674296","html_url":"https://github.com/directus/app/issues/1172#issuecomment-444674296","issue_url":"https://api.github.com/repos/directus/app/issues/1172","id":444674296,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NDY3NDI5Ng==","user":{"login":"rijkvanzanten","id":9141017,"node_id":"MDQ6VXNlcjkxNDEwMTc=","avatar_url":"https://avatars3.githubusercontent.com/u/9141017?v=4","gravatar_id":"","url":"https://api.github.com/users/rijkvanzanten","html_url":"https://github.com/rijkvanzanten","followers_url":"https://api.github.com/users/rijkvanzanten/followers","following_url":"https://api.github.com/users/rijkvanzanten/following{/other_user}","gists_url":"https://api.github.com/users/rijkvanzanten/gists{/gist_id}","starred_url":"https://api.github.com/users/rijkvanzanten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rijkvanzanten/subscriptions","organizations_url":"https://api.github.com/users/rijkvanzanten/orgs","repos_url":"https://api.github.com/users/rijkvanzanten/repos","events_url":"https://api.github.com/users/rijkvanzanten/events{/privacy}","received_events_url":"https://api.github.com/users/rijkvanzanten/received_events","type":"User","site_admin":false},"created_at":"2018-12-05T22:22:22Z","updated_at":"2018-12-05T22:22:22Z","author_association":"CONTRIBUTOR","body":"@kmaris Certain routes are actually server wide. `/interfaces` is correct, so is `/server/ping` or even `/`. The scoped endpoints (eg `/_/items`) are specific to the project you're working in. "}}
{"actor":{"display_login":"rijkvanzanten"}}