-
-
Notifications
You must be signed in to change notification settings - Fork 838
feat: add ProxyHeadersMiddleware and refactored API endpoint paths to prevent redirects #460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…oxies - Integrated ProxyHeadersMiddleware to ensure FastAPI correctly handles HTTPS in redirects when deployed behind a proxy, such as Cloudflare. - This addition enhances security and proper URL handling in the application.
- Modified various FastAPI route definitions to remove trailing slashes for consistency across the application. - Updated corresponding fetch calls in the frontend to align with the new endpoint structure. - Ensured that all affected routes maintain their functionality without trailing slashes.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. WalkthroughThis PR normalizes API endpoint paths by removing trailing slashes across backend FastAPI routes, frontend components, and browser extension code. Additionally, it adds Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (42)
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review by RecurseML
🔍 Review performed on 7a0dc0e..ecd07d6
✨ No bugs found, your code is sparkling clean
✅ Files analyzed, no issues (41)
• surfsense_backend/app/routes/airtable_add_connector_route.py
• surfsense_backend/app/routes/chats_routes.py
• surfsense_backend/app/routes/documents_routes.py
• surfsense_backend/app/routes/google_calendar_add_connector_route.py
• surfsense_backend/app/routes/google_gmail_add_connector_route.py
• surfsense_backend/app/routes/llm_config_routes.py
• surfsense_backend/app/routes/logs_routes.py
• surfsense_backend/app/routes/podcasts_routes.py
• surfsense_backend/app/routes/search_source_connectors_routes.py
• surfsense_backend/app/routes/search_spaces_routes.py
• surfsense_browser_extension/background/messages/savedata.ts
• surfsense_browser_extension/background/messages/savesnapshot.ts
• surfsense_browser_extension/routes/pages/HomePage.tsx
• surfsense_web/app/dashboard/[search_space_id]/chats/chats-client.tsx
• surfsense_web/app/dashboard/[search_space_id]/connectors/add/baidu-search-api/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/connectors/add/clickup-connector/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/connectors/add/confluence-connector/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/connectors/add/discord-connector/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/connectors/add/elasticsearch-connector/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/connectors/add/github-connector/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/connectors/add/jira-connector/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/connectors/add/linear-connector/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/connectors/add/linkup-api/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/connectors/add/luma-connector/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/connectors/add/notion-connector/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/connectors/add/searxng/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/connectors/add/serper-api/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/connectors/add/slack-connector/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/connectors/add/tavily-api/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/documents/webpage/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/documents/youtube/page.tsx
• surfsense_web/app/dashboard/[search_space_id]/podcasts/podcasts-client.tsx
• surfsense_web/components/sidebar/AppSidebarProvider.tsx
• surfsense_web/hooks/use-chat.ts
• surfsense_web/hooks/use-connector-edit-page.ts
• surfsense_web/hooks/use-connectors.ts
• surfsense_web/hooks/use-document-types.ts
• surfsense_web/hooks/use-documents.ts
• surfsense_web/hooks/use-llm-configs.ts
• surfsense_web/hooks/use-logs.ts
• surfsense_web/hooks/use-search-source-connectors.ts
Description
Motivation and Context
Deployment ease
Screenshots
API Changes
Change Type
Testing Performed
Checklist
High-level PR Summary
This PR adds
ProxyHeadersMiddlewareto FastAPI to properly handle proxy headers (e.g., from Cloudflare) ensuring HTTPS is used in redirects, and systematically removes trailing slashes from all API endpoint paths across backend routes, frontend hooks, and browser extension code to prevent unnecessary redirects. Additionally, connector creation forms are updated to include new periodic indexing fields (periodic_indexing_enabled,indexing_frequency_minutes,next_scheduled_at) set to null by default.⏱️ Estimated Review Time: 5-15 minutes
💡 Review Order Suggestion
surfsense_backend/app/app.pysurfsense_backend/app/routes/chats_routes.pysurfsense_backend/app/routes/documents_routes.pysurfsense_backend/app/routes/llm_config_routes.pysurfsense_backend/app/routes/logs_routes.pysurfsense_backend/app/routes/podcasts_routes.pysurfsense_backend/app/routes/search_source_connectors_routes.pysurfsense_backend/app/routes/search_spaces_routes.pysurfsense_backend/app/routes/airtable_add_connector_route.pysurfsense_backend/app/routes/google_calendar_add_connector_route.pysurfsense_backend/app/routes/google_gmail_add_connector_route.pysurfsense_web/hooks/use-chat.tssurfsense_web/hooks/use-connectors.tssurfsense_web/hooks/use-documents.tssurfsense_web/hooks/use-llm-configs.tssurfsense_web/hooks/use-logs.tssurfsense_web/hooks/use-search-source-connectors.tssurfsense_web/hooks/use-document-types.tssurfsense_web/hooks/use-connector-edit-page.tssurfsense_web/components/sidebar/AppSidebarProvider.tsxsurfsense_web/app/dashboard/[search_space_id]/chats/chats-client.tsxsurfsense_web/app/dashboard/[search_space_id]/podcasts/podcasts-client.tsxsurfsense_web/app/dashboard/[search_space_id]/documents/webpage/page.tsxsurfsense_web/app/dashboard/[search_space_id]/documents/youtube/page.tsxsurfsense_web/app/dashboard/[search_space_id]/connectors/add/github-connector/page.tsxsurfsense_web/app/dashboard/[search_space_id]/connectors/add/elasticsearch-connector/page.tsxsurfsense_web/app/dashboard/[search_space_id]/connectors/add/baidu-search-api/page.tsxsurfsense_web/app/dashboard/[search_space_id]/connectors/add/clickup-connector/page.tsxsurfsense_web/app/dashboard/[search_space_id]/connectors/add/confluence-connector/page.tsxsurfsense_web/app/dashboard/[search_space_id]/connectors/add/discord-connector/page.tsxsurfsense_web/app/dashboard/[search_space_id]/connectors/add/jira-connector/page.tsxsurfsense_web/app/dashboard/[search_space_id]/connectors/add/linear-connector/page.tsxsurfsense_web/app/dashboard/[search_space_id]/connectors/add/linkup-api/page.tsxsurfsense_web/app/dashboard/[search_space_id]/connectors/add/luma-connector/page.tsxsurfsense_web/app/dashboard/[search_space_id]/connectors/add/notion-connector/page.tsxsurfsense_web/app/dashboard/[search_space_id]/connectors/add/searxng/page.tsxsurfsense_web/app/dashboard/[search_space_id]/connectors/add/serper-api/page.tsxsurfsense_web/app/dashboard/[search_space_id]/connectors/add/slack-connector/page.tsxsurfsense_web/app/dashboard/[search_space_id]/connectors/add/tavily-api/page.tsxsurfsense_browser_extension/background/messages/savedata.tssurfsense_browser_extension/background/messages/savesnapshot.tssurfsense_browser_extension/routes/pages/HomePage.tsxsurfsense_backend/app/routes/documents_routes.pyget_document_type_countsandget_document_by_chunk_id) are moved from the end of the file to the middle without functional changes, which appears to be an unrelated reorganizationsurfsense_web/app/dashboard/[search_space_id]/connectors/add/baidu-search-api/page.tsxperiodic_indexing_enabled,indexing_frequency_minutes, andnext_scheduled_atto connector creation, which seems like a new feature addition rather than just path refactoringSummary by CodeRabbit
Chores
New Features