Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 4, 2025

Users cannot upload files >20MB. Added configurable client_max_body_size per domain (1MB-10GB range, default 100MB).

Changes

Database

  • Added clientMaxBodySize field to Domain model (nullable int, default 100)
  • Migration: 20251104025114_add_client_max_body_size

Backend

  • Created DEFAULT_CLIENT_MAX_BODY_SIZE constant (100MB)
  • Extended AdvancedConfigData interface with clientMaxBodySize?: number
  • Updated domain repository create/update to persist field
  • Modified nginx config service to inject client_max_body_size directive in both HTTP and HTTPS server blocks

Frontend

  • Added number input to domain dialog Advanced tab (validation: 1-10000)
  • Wired to advancedConfig.clientMaxBodySize in API payload

Generated Config

Setting a domain to 250MB produces:

server {
    listen 80;
    server_name example.com;
    
    client_max_body_size 250M;
    # ... rest of config
}

Existing domains will default to 100MB after migration.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkpoint.prisma.io
    • Triggering command: /usr/local/bin/node /home/REDACTED/.npm/_npx/2778af9cee32ff87/node_modules/prisma/build/child {"product":"prisma","version":"6.18.0","cli_install_type":"local","information":"","local_timestamp":"2025-11-04T02:53:39Z","project_hash":"a902f162","cli_path":"/home/REDACTED/.npm/_npx/2778af9cee32ff87/node_modules/.bin/prisma","cli_path_hash":"5a8877e8","endpoint":"REDACTED","disable":false,"arch":"x64","os":"linux","node_version":"v20.19.5","ci":true,"ci_name":"GitHub Actions","command":"migrate dev --name [redacted] --create-only","schema_providers":["postgresql"],"schema_preview_features":[],"schema_generators_providers":["prisma-client-js"],"cache_file":"/home/REDACTED/.cache/checkpoint-nodejs/prisma-5a8877e8","cache_duration":43200000,"remind_duration":172800000,"force":false,"timeout":5000,"unref":true,"child_path":"/home/REDACTED/.npm/_npx/2778af9cee32ff87/node_modules/prisma/build/child","client_event_id":"","previous_client_event_id":"","check_if_update_available":true} (dns block)
    • Triggering command: /usr/local/bin/node /home/REDACTED/.npm/_npx/2778af9cee32ff87/node_modules/prisma/build/child {"product":"prisma","version":"6.18.0","cli_install_type":"local","information":"","local_timestamp":"2025-11-04T02:54:04Z","project_hash":"a902f162","cli_path":"/home/REDACTED/.npm/_npx/2778af9cee32ff87/node_modules/.bin/prisma","cli_path_hash":"5a8877e8","endpoint":"REDACTED","disable":false,"arch":"x64","os":"linux","node_version":"v20.19.5","ci":true,"ci_name":"GitHub Actions","command":"migrate dev --name [redacted] --create-only","schema_providers":["postgresql"],"schema_preview_features":[],"schema_generators_providers":["prisma-client-js"],"cache_file":"/home/REDACTED/.cache/checkpoint-nodejs/prisma-5a8877e8","cache_duration":43200000,"remind_duration":172800000,"force":false,"timeout":5000,"unref":true,"child_path":"/home/REDACTED/.npm/_npx/2778af9cee32ff87/node_modules/prisma/build/child","client_event_id":"","previous_client_event_id":"","check_if_update_available":true} (dns block)
    • Triggering command: /usr/local/bin/node /home/REDACTED/work/nginx-love/nginx-love/apps/api/node_modules/prisma/build/child {"product":"prisma","version":"5.22.0","cli_install_type":"local","information":"","local_timestamp":"2025-11-04T02:59:30Z","project_hash":"a902f162","cli_path":"/home/REDACTED/work/nginx-love/nginx-love/apps/api/node_modules/prisma/build/index.js","cli_path_hash":"38728486","endpoint":"REDACTED","disable":false,"arch":"x64","os":"linux","node_version":"v20.19.5","ci":true,"ci_name":"GitHub Actions","command":"generate --postinstall \"UNABLE_TO_FIND_POSTINSTALL_TRIGGER__ENVAR_MISSING\"","schema_providers":["postgresql"],"schema_preview_features":[],"schema_generators_providers":["prisma-client-js"],"cache_file":"/home/REDACTED/.cache/checkpoint-nodejs/prisma-38728486","cache_duration":43200000,"remind_duration":172800000,"force":false,"timeout":5000,"unref":true,"child_path":"/home/REDACTED/work/nginx-love/nginx-love/apps/api/node_modules/prisma/build/child","client_event_id":"","previous_client_event_id":"","check_if_update_available":true} (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>*4063 Request body limit is marked to reject the request</issue_title>
<issue_description>Bị lỗi này không thể upload file lớn trên 20mb</issue_description>

<agent_instructions>Please adjust the configuration form to add domains and edit domain config to have an option to allow users to set client_max_body_size with arbitrary capacity measured in mb (Megabytes)</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@vncloudsco Cám ơn bạn mình sẽ kiểm tra vấn đề này và cập nhập ngay khi có thể

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Added clientMaxBodySize field to Domain model in Prisma schema (default 100MB)
- Created database migration for new field
- Updated backend types and DTOs to support clientMaxBodySize
- Updated domains repository to handle clientMaxBodySize in create/update operations
- Updated nginx-config service to include client_max_body_size directive in generated configs
- Updated frontend DomainDialogV2 to add input field for clientMaxBodySize in Advanced tab
- Builds successfully on both backend and frontend

Co-authored-by: vncloudsco <[email protected]>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 4, 2025

Please retry analysis of this Pull-Request directly on SonarQube Cloud

- Created domain.constants.ts with DEFAULT_CLIENT_MAX_BODY_SIZE constant
- Updated domains.repository.ts to use the constant
- Updated nginx-config.service.ts to use the constant via helper method
- Added getClientMaxBodySize() helper method to reduce code duplication
- Improves maintainability by centralizing the default value

Co-authored-by: vncloudsco <[email protected]>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 4, 2025

Copilot AI changed the title [WIP] Add option to set client_max_body_size for uploads Add per-domain client_max_body_size configuration Nov 4, 2025
Copilot AI requested a review from vncloudsco November 4, 2025 03:09
Copilot finished work on behalf of vncloudsco November 4, 2025 03:09
Copy link
Contributor

@vncloudsco vncloudsco left a comment

Choose a reason for hiding this comment

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

The review process completes the generated configuration to ensure compliance with the principles.

image image

@github-actions
Copy link

github-actions bot commented Nov 4, 2025

Coverage Report for apps/api

Status Category Percentage Covered / Total
🔵 Lines 3.28% 556 / 16947
🔵 Statements 3.28% 556 / 16947
🔵 Functions 54.39% 99 / 182
🔵 Branches 62.13% 151 / 243
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/api/src/domains/domains/domains.repository.ts 0% 0% 0% 0% 1-373
apps/api/src/domains/domains/domains.types.ts 100% 100% 100% 100%
apps/api/src/domains/domains/services/nginx-config.service.ts 0% 0% 0% 0% 1-765
apps/api/src/shared/constants/domain.constants.ts 0% 100% 100% 0% 9
Generated in workflow #68 for commit e0946fc by the Vitest Coverage Report Action

@vncloudsco vncloudsco marked this pull request as ready for review November 4, 2025 03:58
Copilot AI review requested due to automatic review settings November 4, 2025 03:58
Copy link

Copilot AI left a comment

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 adds support for configuring the maximum request body size (client_max_body_size) for Nginx domains. This allows administrators to control file upload size limits on a per-domain basis.

  • Adds clientMaxBodySize field to domain schema with a default value of 100MB
  • Implements UI controls in the domain dialog for configuring this setting
  • Generates appropriate Nginx configuration with the client_max_body_size directive

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
apps/api/prisma/schema.prisma Adds clientMaxBodySize field to Domain model with default 100
apps/api/prisma/migrations/20251104025114_add_client_max_body_size/migration.sql Database migration to add the new column
apps/api/src/shared/constants/domain.constants.ts Defines constant for default client max body size
apps/api/src/domains/domains/domains.types.ts Adds clientMaxBodySize to AdvancedConfigData interface
apps/api/src/domains/domains/domains.repository.ts Handles persistence of clientMaxBodySize in create/update operations
apps/api/src/domains/domains/services/nginx-config.service.ts Generates client_max_body_size directive in Nginx configs
apps/web/src/components/domains/DomainDialogV2.tsx Adds UI input field with validation for configuring max body size

@vncloudsco vncloudsco merged commit 4f99aca into main Nov 4, 2025
10 checks passed
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.

*4063 Request body limit is marked to reject the request

2 participants