Skip to content

integrate using reverse proxy#3

Open
pvvhoang wants to merge 3 commits into
portal_integrationfrom
reverse_proxy
Open

integrate using reverse proxy#3
pvvhoang wants to merge 3 commits into
portal_integrationfrom
reverse_proxy

Conversation

@pvvhoang

@pvvhoang pvvhoang commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

For integrating Portal and Explorer using reverse proxy

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts Explorer’s hosted configuration to support integration behind a reverse proxy by making the API base URL configurable via environment variables.

Changes:

  • Switch hosted/config.yaml to read server.app.api_base_url from API_BASE_URL (allowing null to register routes at /).
  • Add reverse-proxy-related environment variables to docker-compose.yml to populate API_BASE_URL.
  • Document reverse-proxy env vars in .env.example.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
hosted/config.yaml Makes api_base_url configurable via API_BASE_URL for reverse-proxy setups.
docker-compose.yml Adds env wiring intended to compute/pass API_BASE_URL into the Explorer container.
.env.example Adds example reverse-proxy environment variables for local integration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docker-compose.yml Outdated
Comment on lines +53 to +54
- DEFAULT_API_BASE_URL=${PROXY_TRANSFER_PROTOCOL}://${PROXY_API_DOMAIN}/cellxgene/
- API_BASE_URL=${PROXY_API_BASE_URL:-DEFAULT_API_BASE_URL}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment thread .env.example Outdated
Comment on lines +8 to +9
PROXY_TRANSFER_PROTOCOL=https # for outside container
PROXY_API_DOMAIN=explorer.corporanet.local:5500 # for outside container

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment thread hosted/config.yaml
Comment on lines +28 to 32
# ${TRANSFER_PROTOCOL}://${API_DOMAIN}/cellxgene/: Flask registers all API routes under a specific prefix
# null: Flask registers routes at /, so urls (e.g., /e/<dataset>/...) match correctly
# api_base_url: ${TRANSFER_PROTOCOL}://${API_DOMAIN}/cellxgene/
api_base_url: ${API_BASE_URL}
web_base_url: ${TRANSFER_PROTOCOL}://${WEB_DOMAIN}/

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API_BASE_URL is set in docker-compose.yml, thus it should be available in the container.

@pvvhoang pvvhoang marked this pull request as ready for review June 2, 2026 06:45
Comment thread docker-compose.yml Outdated
- RESTART_ON_FAILURE=yes
- DEV_MODE_COOKIES=1
- IS_DOCKER_DEV=yes # This skips some unit tests.
- API_BASE_URL=${PROXY_API_BASE_URL:-${PROXY_TRANSFER_PROTOCOL}://${PROXY_API_DOMAIN}/cellxgene/}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the PROXY_TRANSFER_PROTOCOL and PROXY_API_DOMAIN come from the .env file?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they come from the .env file.

Comment thread hosted/config.yaml
# ${TRANSFER_PROTOCOL}://${API_DOMAIN}/cellxgene/: Flask registers all API routes under a specific prefix
# null: Flask registers routes at /, so urls (e.g., /e/<dataset>/...) match correctly
# api_base_url: ${TRANSFER_PROTOCOL}://${API_DOMAIN}/cellxgene/
api_base_url: ${API_BASE_URL}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused about what API_BASE_URL will actually be when running in different environments. It seems to be overwritten by the docker-compose

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your comment, I think the environment variable names cause some confusion, thus I have updated a bit to make it clearer.

(Below is based on the updated scripts)

If we use reverse proxy:
+ We set PROXY_API_BASE_URL=null in .env file
+ In docker-compose.yml, API_BASE_URL=${PROXY_API_BASE_URL} # null
+ Then in config.yaml, api_base_url: ${API_BASE_URL} # null

If we do not use reverse proxy (i.e., it is as the default):
+ We do not set PROXY_API_BASE_URL in .env file
+ In docker-compose.yml, API_BASE_URL=${TRANSFER_PROTOCOL}://${API_DOMAIN}/cellxgene/
+ Then in config.yaml, api_base_url: ${API_BASE_URL}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants