Skip to content

fix: fixed domain mapping to return to treafik#112

Open
Pieterv24 wants to merge 2 commits into
hhftechnology:mainfrom
Pieterv24:fix_domain_proxy_merge
Open

fix: fixed domain mapping to return to treafik#112
Pieterv24 wants to merge 2 commits into
hhftechnology:mainfrom
Pieterv24:fix_domain_proxy_merge

Conversation

@Pieterv24

@Pieterv24 Pieterv24 commented Jul 16, 2026

Copy link
Copy Markdown

The domains object in the TLS field of routers is not being passed though to traefik correctly.
This messes with the ability of Traefik to create wildcard domains.

Response from pangolin (expected from MM too):

{
    "http": {
        "middlewares": {
            ...
        },
        "routers": {
            "8-example-router": {
                "entryPoints": [
                    "websecure"
                ],
                "middlewares": [
                    "badger"
                ],
                "service": "8-example-service",
                "rule": "Host(`target.example.com`)",
                "priority": 100,
                "tls": {
                    "certResolver": "letsencrypt",
                    "domains": [
                        {
                            "main": "*.example.com"
                        }
                    ]
                }
            },
        },
        "services": {
			...
        }
    }

Response from Middleware Manager:

{
    "http": {
        "middlewares": {
            ...
        },
        "routers": {
            "8-example-router": {
                "entryPoints": [
                    "websecure"
                ],
                "middlewares": [
                    "badger"
                ],
                "service": "8-example-service",
                "rule": "Host(`target.example.com`)",
                "priority": 100,
                "tls": {
                    "certResolver": "letsencrypt"
                }
            },
        },
        "services": {
			...
        }
    }

This PR should address the issue.

Summary by CodeRabbit

  • Bug Fixes
    • TLS domain configurations now preserve mixed entries, keeping both plain string domains and structured domain objects intact.
    • Ordered TLS output has been updated to retain the original domain configuration format without stripping non-string items.

@vercel

vercel Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

@Pieterv24 is attempting to deploy a commit to the HHF Technologies' projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8af31f92-ab38-42c5-8388-84bc13fc3de5

📥 Commits

Reviewing files that changed from the base of the PR and between 40e148f and 851f94f.

📒 Files selected for processing (1)
  • services/config_proxy.go
📜 Recent review details
⚠️ CI failures not shown inline (1)

Commit Status: Vercel: Vercel

Conclusion: failure

Authorization required to deploy.
🔇 Additional comments (1)
services/config_proxy.go (1)

1265-1274: LGTM!


📝 Walkthrough

Walkthrough

TLS ordered configuration now represents domains as mixed values and preserves string or object entries during TLS normalization.

Changes

TLS domain preservation

Layer / File(s) Summary
Ordered TLS domain normalization
services/config_proxy.go
OrderedTLSConfig.Domains accepts []interface{}, and TLS normalization retains string and object domain entries without filtering.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

I’m a rabbit with domains in a row,
Strings and objects now safely flow.
No entry gets lost in the TLS night,
Ordered and preserved just right.
Hop, hop—config takes flight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is related to the main change: preserving and mapping TLS domains for Traefik.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request changes the Domains field in OrderedTLSConfig from []string to []interface{} to allow preserving the original format of domains. However, removing the []string case in the type switch will cause any []string values to be silently ignored. It is recommended to handle the []string case by explicitly converting it to []interface{} to avoid potential configuration loss.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread services/config_proxy.go
Comment on lines 1262 to 1266
switch v := domains.(type) {
case []interface{}:
for _, d := range v {
if s, ok := d.(string); ok {
ordered.Domains = append(ordered.Domains, s)
}
}
case []string:
// Preserve original format as-is (strings or objects)
ordered.Domains = v
}

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

By removing the case []string: block, any domains slice of type []string (which can occur in unit tests or when constructed programmatically) will be silently ignored because it does not match case []interface{}:. In Go, []string cannot be directly assigned to []interface{}, so we must explicitly convert it to preserve the original behavior and prevent potential configuration loss.

Suggested change
switch v := domains.(type) {
case []interface{}:
for _, d := range v {
if s, ok := d.(string); ok {
ordered.Domains = append(ordered.Domains, s)
}
}
case []string:
// Preserve original format as-is (strings or objects)
ordered.Domains = v
}
switch v := domains.(type) {
case []interface{}:
// Preserve original format as-is (strings or objects)
ordered.Domains = v
case []string:
ordered.Domains = make([]interface{}, len(v))
for i, s := range v {
ordered.Domains[i] = s
}
}

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@services/config_proxy.go`:
- Around line 1261-1266: Update mapToOrderedTLS so the tls["domains"] handling
preserves []map[string]interface{} and []string in addition to []interface{},
converting each typed slice into the expected ordered domain representation
without altering its entries. Add a regression test covering generated
object-shaped domains from config_generator.go.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 48871765-16e1-4adc-826e-da62d0c99168

📥 Commits

Reviewing files that changed from the base of the PR and between 7eb1378 and 40e148f.

📒 Files selected for processing (1)
  • services/config_proxy.go
📜 Review details
⚠️ CI failures not shown inline (1)

Commit Status: Vercel: Vercel

Conclusion: failure

Authorization required to deploy.
🔇 Additional comments (1)
services/config_proxy.go (1)

67-69: LGTM!

Comment thread services/config_proxy.go
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