Skip to content

fix(proxy): Prevent duplicate domains and restore vhost on failure#72

Merged
nfebe merged 1 commit intomainfrom
fix/domain-add-failures
Feb 3, 2026
Merged

fix(proxy): Prevent duplicate domains and restore vhost on failure#72
nfebe merged 1 commit intomainfrom
fix/domain-add-failures

Conversation

@nfebe
Copy link
Contributor

@nfebe nfebe commented Feb 3, 2026

  • Add duplicate domain+path validation in addDomain API endpoint
  • Add nginx warning tolerance (ssl_stapling warnings no longer fail)
  • Add location deduplication in config generator to prevent duplicate location "/" errors
  • Add vhost backup/restore on proxy setup failure instead of deletion
  • Add WriteVirtualHost and GetVirtualHost to NginxManager interface

Fixes issue where adding domains would fail due to ssl_stapling warnings and corrupt vhost config by deleting it on failure.

- Add duplicate domain+path validation in addDomain API endpoint
- Add nginx warning tolerance (ssl_stapling warnings no longer fail)
- Add location deduplication in config generator to prevent duplicate
  location "/" errors
- Add vhost backup/restore on proxy setup failure instead of deletion
- Add WriteVirtualHost and GetVirtualHost to NginxManager interface

Fixes issue where adding domains would fail due to ssl_stapling warnings
and corrupt vhost config by deleting it on failure.

Signed-off-by: nfebe <fenn25.fn@gmail.com>
@sourceant
Copy link

sourceant bot commented Feb 3, 2026

Code Review Summary

✨ This pull request significantly enhances the robustness and reliability of the Nginx proxy configuration management within the agent. Key improvements include a new rollback mechanism for Nginx virtual host updates, preventing system outages from bad configurations. Additionally, the system now correctly handles duplicate domain definitions and location blocks, and Nginx config validation has been made more intelligent to distinguish between fatal errors and warnings.

🚀 Key Improvements

  • Implemented a critical rollback mechanism for Nginx virtual host configuration changes in internal/proxy/orchestrator.go, ensuring previous stable configurations can be restored upon validation failure.
  • Introduced deduplication logic for Nginx location blocks in internal/nginx/manager.go, preventing Nginx configuration syntax errors when multiple domain rules target the same path.
  • Enhanced TestConfig in internal/nginx/manager.go to correctly identify and log Nginx configuration warnings without treating them as fatal errors, improving operational insights.
  • Added validation in internal/api/server.go to prevent the creation of duplicate domains (based on domain name and path prefix), maintaining data integrity and preventing Nginx configuration conflicts.
  • Expanded test coverage in internal/nginx/manager_test.go and internal/proxy/orchestrator_test.go to validate these new features and improvements.

Copy link

@sourceant sourceant bot left a comment

Choose a reason for hiding this comment

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

Review complete. See the overview comment for a summary.

@nfebe nfebe merged commit b25553d into main Feb 3, 2026
5 checks passed
@nfebe nfebe deleted the fix/domain-add-failures branch February 3, 2026 20:55
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.

1 participant