Skip to content

Enable HSTS in production and add HTTPS redirection - #1

Merged
Jose Perez Rodriguez (joperezr) merged 19 commits into
mainfrom
hsts
Oct 30, 2025
Merged

Jose Perez Rodriguez (joperezr) merged 19 commits into
mainfrom
hsts

Conversation

@IEvangelist

@IEvangelist David Pine (IEvangelist) commented Oct 29, 2025 •

Copy link
Copy Markdown
Member

In this PR:

  • Address security scan: Added HSTS in prod.
  • Minor text clean up around prerequisites.
  • Update Aspire CLI content.
  • Remove custom SynchedTabs component, now that the native Tabs component supports sync.
  • Address misc feedback.
  • Fixed report contrast issue on Safari.
  • De-duplicate Install Aspire CLI content.
  • Move .slnx to repo root directory.
  • Correct some inconsistencies with capitalization.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 enhances security for the static host by adding HTTPS redirection and HSTS (HTTP Strict Transport Security) middleware, along with some minor code formatting improvements.

  • Adds HSTS middleware (only enabled in production environments)
  • Adds HTTPS redirection middleware
  • Removes trailing whitespace from several lines

Comment thread src/statichost/StaticHost/Program.cs Resolved
<TabItem label="PowerShell" icon="seti:powershell">
<Code
lang="powershell"
code='Invoke-RestMethod https://aspire.dev/install.ps1 -OutFile aspire-install.ps1'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should this instead be the exact line we use in the aspire repo? e.g. iex "& { $(irm https://aspire.dev/install.ps1) }" and curl bash for the non-Windows one

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Left some minor comments but otherwise this looks good

…n; update welcome banner with migration notice
David Pine (IEvangelist) pushed a commit that referenced this pull request Oct 30, 2026
…next frame (#1993)

## Summary

On the homepage's environment section (Local / Test / Production),
switching environments is supposed to fade the new panel in.
`HomeEnvironment.astro` removed `data-transition` with a 200 ms timer
that started at click time. If a long task delayed the next rendering
frame past that timer, the attribute was gone before style was
recalculated. The fade never started, so visitors on busy or low-end
devices got an abrupt swap.

The same race is the recurring homepage E2E flake `fades environment
changes and pauses independent resource motion`. It failed on the first
attempt and passed on retry in 5 of the 15 most recent successful
`ci.yml` runs I scanned. Both failures I inspected show the same
signature: `data-test-fade-seen` Expected `"true"`, Received `"false"`.
For example:

- [run 41019013048, job
123945024940](https://github.com/microsoft/aspire.dev/actions/runs/41019013048/job/123945024940):
the `Test` panel, retry #1 passed.
- [run 40915515140, job
123611762564](https://github.com/microsoft/aspire.dev/actions/runs/40915515140/job/123611762564):
the `Local` panel, retry #1 passed.

**Fix:** after setting `data-transition`, call
`nextPanel.getAnimations()`. This flushes style, so the CSS fade is
created synchronously. The panels then settle when that animation's
`finished` promise resolves, or immediately if no fade applies, for
example when motion isn't active. No timeouts, sleeps or retries are
added; the fixed timer is removed. Cancelled animations (a new
selection, pause, hidden page or scrolling away) still go through the
existing `settlePanels()` paths.

**Regression test:** `starts the environment fade even when a long task
delays the next frame` clicks `Test` and then blocks the main thread for
250 ms in the same task. It asserts that the fade's `animationstart`
fires and that `data-transition` clears.

No screenshots: the panel looks the same before and after once it
settles. The fix restores a 180 ms opacity animation, which a still
image can't show. The evidence is the `animationstart` assertion above.

## Third-party links and affiliations

None

## Validation

- New regression test, run locally against `astro dev` in desktop,
tablet and mobile Chromium:
- Without the fix, on the same branch: **9/9 failed** (3 repeats per
project), with `data-test-fade-seen` Expected `"true"`, Received
`"false"`. This matches the CI flake.
  - With the fix: **30/30 passed** (10 repeats per project).
- All homepage tests matching `environment`, run twice each across the 3
projects (including the existing fade test): 24/24 passed.
- `vitest run`: 82 files; 1108 passed, 1 skipped.
- `eslint . --max-warnings 0` passes, and `prettier --check` on
`HomeEnvironment.astro` passes. The new test block is Prettier-clean;
`homepage.spec.ts` already has a Prettier warning on `main`.

**🤖 Posted by AspireAgent (AI Agent)**

Co-authored-by: davidfowl <[email protected]>
Co-authored-by: Copilot <[email protected]>
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.

3 participants