feat: Add single-origin reverse proxy deployment with runtime web config#1499
Conversation
…port-architecture
…es for frontend auth and backend user profiles
…for improved URL handling
… constants for auth type, deployment mode, and ETL service
…ACKEND_URL for improved consistency across workflows and scripts
|
@AnishSarkar22 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…o use CMD for server execution
… related configurations for improved messaging gateway handling
…ls notification to enhance user experience
Description
NEXT_PUBLICvalues as build-time fallbacks where needed.HOSTED_BACKEND_URL, replacing directBACKEND_URLusage across auth, dashboard, connectors, document upload, and callback flows.SURFSENSE_PUBLIC_URL, aligning app behavior with same-origin proxy deployments.GATEWAY_ENABLED=FALSE.Motivation and Context
FIX #576, #1495
Screenshots
API Changes
Change Type
Testing Performed
Checklist
High-level PR Summary
This PR introduces a bundled Caddy reverse proxy for SurfSense Docker deployments, consolidating the frontend, backend, and zero-cache services behind a single public origin. The changes eliminate the need for multiple exposed ports and enable automatic HTTPS for custom domains. The frontend now reads runtime configuration (
AUTH_TYPE,ETL_SERVICE,DEPLOYMENT_MODE) server-side instead of baking them at build time, allowing a single Docker image to support multiple deployment modes. Build-timeNEXT_PUBLIC_*environment variable substitution is removed in favor of same-origin relative browser URLs (/api/v1,/auth,/zero) routed internally by Caddy. A newbuildBackendUrlhelper ensures browser-facing backend URLs work in both proxy and packaged-client modes. The backend drops theflowerdependency, connector OAuth callback URIs update to use the public URL, and documentation reflects the single-origin architecture. CI workflows simplify environment variable handling, and ESLint rules prevent direct import of the now-emptyBACKEND_URLconstant to enforce consistent same-origin URL construction.⏱️ Estimated Review Time: 1-3 hours
💡 Review Order Suggestion
docker/.env.exampledocker/docker-compose.ymldocker/proxy/Caddyfiledocker/proxy/Dockerfiledocker/docker-compose.proxy.ymldocker/docker-compose.dev.ymldocker/scripts/install.shsurfsense_web/lib/env-config.tssurfsense_web/components/providers/runtime-config.tsxsurfsense_web/components/providers/runtime-config.server.tsxsurfsense_web/app/dashboard/layout.tsxsurfsense_web/app/dashboard/dashboard-shell.tsxsurfsense_web/app/(home)/login/layout.tsxsurfsense_web/app/(home)/register/layout.tsxsurfsense_web/app/desktop/login/layout.tsxsurfsense_web/app/api/v1/[...path]/route.tssurfsense_web/app/auth/[...path]/route.tssurfsense_web/components/providers/ZeroProvider.tsxsurfsense_web/Dockerfilesurfsense_web/docker-entrypoint.shsurfsense_web/docker-entrypoint.jssurfsense_backend/app/config/__init__.pysurfsense_web/eslint.config.mjssurfsense_web/app/(home)/login/page.tsxsurfsense_web/app/(home)/login/GoogleLoginButton.tsxsurfsense_web/app/(home)/login/LocalLoginForm.tsxsurfsense_web/app/(home)/register/page.tsxsurfsense_web/app/desktop/login/page.tsxsurfsense_web/components/auth/sign-in-button.tsxsurfsense_web/components/assistant-ui/connector-popup/tabs/all-connectors-tab.tsxsurfsense_web/app/dashboard/[search_space_id]/new-chat/[[...chat_id]]/page.tsxsurfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsxsurfsense_web/components/sources/DocumentUploadTab.tsxsurfsense_web/components/sources/FolderWatchDialog.tsxsurfsense_web/lib/supported-extensions.tssurfsense_web/lib/auth-utils.tssurfsense_web/lib/apis/base-api.service.tssurfsense_web/lib/apis/anonymous-chat-api.service.tssurfsense_web/hooks/use-search-source-connectors.tssurfsense_web/components/assistant-ui/connector-popup/hooks/use-connector-dialog.tssurfsense_web/components/assistant-ui/connector-popup/connector-configs/views/connector-edit-view.tsxsurfsense_web/components/assistant-ui/connector-popup/views/connector-accounts-list-view.tsxsurfsense_web/components/assistant-ui/connector-popup/connector-configs/components/circleback-config.tsxsurfsense_web/components/layout/ui/tabs/DocumentTabContent.tsxsurfsense_web/components/editor-panel/editor-panel.tsxsurfsense_web/components/editor-panel/memory.tssurfsense_web/components/report-panel/report-panel.tsxsurfsense_web/components/settings/general-settings-manager.tsxsurfsense_web/components/documents/download-original-button.tsxsurfsense_web/app/dashboard/[search_space_id]/user-settings/components/MessagingChannelsContent.tsxsurfsense_web/components/tool-ui/generate-resume.tsxsurfsense_web/components/tool-ui/podcast/player.tsxsurfsense_web/components/tool-ui/sandbox-execute.tsxsurfsense_web/components/tool-ui/video-presentation/generate-video-presentation.tsxsurfsense_web/components/free-chat/anonymous-chat.tsxsurfsense_web/components/free-chat/free-chat-page.tsxsurfsense_web/components/homepage/hero-section.tsxsurfsense_web/lib/chat/thread-persistence.tssurfsense_web/app/verify-token/route.tssurfsense_web/app/api/zero/query/route.tssurfsense_web/app/dashboard/[search_space_id]/connectors/callback/route.tssurfsense_web/app/(home)/free/page.tsxsurfsense_web/app/(home)/free/[model_slug]/page.tsxsurfsense_web/app/sitemap.tssurfsense_web/.env.examplesurfsense_web/playwright.config.ts.github/workflows/desktop-release.yml.github/workflows/docker-build.yml.github/workflows/e2e-tests.ymlsurfsense_desktop/scripts/build-electron.mjssurfsense_desktop/src/modules/server.tssurfsense_backend/pyproject.tomlsurfsense_backend/uv.locksurfsense_web/content/docs/docker-installation/docker-compose.mdxsurfsense_web/content/docs/docker-installation/dev-compose.mdxsurfsense_web/content/docs/docker-installation/install-script.mdxsurfsense_web/content/docs/manual-installation.mdxsurfsense_web/content/docs/how-to/zero-sync.mdxsurfsense_web/content/docs/messaging-channels/docker.mdxsurfsense_web/components/assistant-ui/connector-popup/connect-forms/components/obsidian-connect-form.tsxsurfsense_backend/pyproject.tomlflowerCelery monitoring dependency, which appears unrelated to the reverse proxy architecture changes.surfsense_web/app/(home)/free/[model_slug]/page.tsxflatMapexpression for static params generation in an unrelated free-chat page, which does not involve reverse proxy or environment variable changes.