Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions backend/app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ class StagingConfig(BaseConfig):
ALLOWED_HOSTS: List[str] = [
"taimako.onrender.com",
"taimakoai.onrender.com",
"localhost",
"127.0.0.1",
Comment on lines +99 to +100

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

While adding "localhost" and "127.0.0.1" to StagingConfig.ALLOWED_HOSTS successfully resolves the health check failures in staging, the production environment (ProductionConfig) will likely suffer from the exact same issue if it is also hosted on Render (or any platform using local loopback health probes).

To prevent production deployment failures or health check rejections by TrustedHostMiddleware, please ensure "localhost" and "127.0.0.1" are also added to ProductionConfig.ALLOWED_HOSTS:

class ProductionConfig(BaseConfig):
    ...
    ALLOWED_HOSTS: List[str] = [
        "taimako.dubem.xyz",
        "api.taimako.dubem.xyz",
        "*.taimako.dubem.xyz",
        "localhost",
        "127.0.0.1",
    ]

]
Comment on lines +99 to 101

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 For better maintainability, consider adding a comment explaining why `localhost` and `127.0.0.1` are included in the allowed hosts for the staging environment. This provides helpful context for future developers.
Suggested change
"localhost",
"127.0.0.1",
]
"taimako.onrender.com",
"taimakoai.onrender.com",
# Allow health checks from Render's internal network
"localhost",
"127.0.0.1",
]


class ProductionConfig(BaseConfig):
Expand Down
4 changes: 2 additions & 2 deletions backend/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@
app.include_router(orders_router)


@app.get("/")
@app.api_route("/", methods=["GET", "HEAD"])
async def root():
return success_response(message="Agentic RAG API is running")

@app.get("/health")
@app.api_route("/health", methods=["GET", "HEAD"])
async def health_check():
return {"status": "healthy"}
Loading