Skip to content

Conversation

@Adammatthiesen
Copy link
Member

@Adammatthiesen Adammatthiesen commented Sep 25, 2025

This pull request focuses on improving URL handling throughout the codebase, particularly ensuring URLs use HTTPS for better security and simplifying related utility functions. The changes also update how environment variables are parsed and used, and make sure that Open Graph and Twitter meta tags consistently use HTTPS URLs.

URL Handling and Security Improvements:

  • Added a convertToHTTPS function in Head.astro to ensure URLs use the HTTPS protocol for Open Graph and Twitter meta tags, and updated all relevant meta tags to use these safe URLs. [1] [2] [3] [4]
  • Removed unnecessary URL manipulation functions (stripHTTPandHTTPS, stripTrailingSlash, setHTTP) from astro-config-utils.ts, keeping only setHTTPS for consistent HTTPS enforcement.

Environment Variable and Config Usage:

  • Simplified the getCoolifyURL function in astro-config-utils.ts to always return an HTTPS URL and removed the option to return HTTP, improving consistency and security.
  • Updated astro.config.mts to use the new getCoolifyURL function, ensuring the site URL is always HTTPS and removing the legacy HTTP option.

Summary by CodeRabbit

  • Bug Fixes

    • All public-facing URLs now enforce HTTPS, including canonical, Open Graph, and Twitter meta tags. This prevents mixed-content warnings, improves SEO, and ensures reliable, secure link previews across platforms.
  • Refactor

    • Simplified URL handling by standardizing on a single HTTPS site URL, reducing configuration complexity and ensuring consistent behavior across the app.

@coderabbitai
Copy link

coderabbitai bot commented Sep 25, 2025

📝 Walkthrough

Walkthrough

The changes enforce HTTPS across configuration and metadata. getCoolifyURL() now always returns an HTTPS URL with a simplified signature. Astro site config updates to call it without arguments. Head.astro adds a helper to convert any http URL to https for og, twitter, canonical, and URL meta tags.

Changes

Cohort / File(s) Summary
Config URL resolution
www/astro-config-utils.ts, www/astro.config.mts
Removed unused HTTP helpers; simplified getCoolifyURL signature to no-arg and always HTTPS; updated astro.config.mts to import once and call getCoolifyURL() for site configuration.
Head metadata HTTPS normalization
www/src/components/Head.astro
Added convertToHTTPS(url) utility; computed safeUrl and safeOgImage; updated og:image, og:url, twitter:url, twitter:image, and canonical link to use HTTPS-safe values.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Build/Runtime
  participant Config as astro-config-utils.getCoolifyURL
  participant Astro as Astro (Head.astro)
  participant Meta as Head Meta Tags

  Dev->>Config: getCoolifyURL()
  Note right of Config: Reads COOLIFY_FQDN<br/>Selects first URL<br/>Forces HTTPS
  Config-->>Dev: https://... (URL)

  Dev->>Astro: Render page (Astro.url, ogImage)
  Astro->>Astro: convertToHTTPS(Astro.url)
  Astro->>Astro: convertToHTTPS(ogImage or '/og.png')
  Astro->>Meta: Emit og:url, twitter:url, canonical, og:image, twitter:image (HTTPS)
  Note over Meta: All public-facing URLs use HTTPS
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit hops through links so bright,
Flips http to https tight,
Meta moons now shimmer true,
Coolify’s path made crisp and new,
With ears up high I thump, “All set!”
Secure carrots cached—no regrets. 🥕🔒

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly captures both key aspects of the changeset: updating the Coolify environment URL helper and enforcing HTTPS for all head link references, making it clear and directly relevant to the modifications described.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch adam/tweak-env

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 and usage tips.

@Adammatthiesen Adammatthiesen changed the title tweak coolify env grabber tweak coolify env grabber and ensure all head links are https Sep 25, 2025
@Adammatthiesen Adammatthiesen marked this pull request as ready for review September 25, 2025 20:56
@Adammatthiesen Adammatthiesen requested a review from a team as a code owner September 25, 2025 20:56
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3dfb296 and f37b9d7.

📒 Files selected for processing (3)
  • www/astro-config-utils.ts (1 hunks)
  • www/astro.config.mts (1 hunks)
  • www/src/components/Head.astro (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
www/astro.config.mts (1)
www/astro-config-utils.ts (1)
  • getCoolifyURL (17-25)
🔇 Additional comments (2)
www/astro.config.mts (1)

4-12: Site fallback now consistently defaults to HTTPS

Importing the simplified helper and defaulting the site config to HTTPS keeps things tidy while still honoring env-based overrides. Looks good.

www/src/components/Head.astro (1)

18-85: HTTPS sanitation in head metadata looks solid

The helper cleanly upgrades request and image URLs to HTTPS, and wiring safeUrl/safeOgImage through Open Graph, Twitter, and canonical tags should eliminate the previous mixed-content edge cases. Nicely done.

@Adammatthiesen Adammatthiesen merged commit 7f69b82 into main Sep 25, 2025
1 check passed
@Adammatthiesen Adammatthiesen deleted the adam/tweak-env branch September 25, 2025 23:14
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.

4 participants