withastro / adapters

Home for Astro's core maintained adapters
70 stars 41 forks source link

feat(vercel): allow external redirects #404

Open wotschofsky opened 1 month ago

wotschofsky commented 1 month ago

This PR was originally opened on the main Astro repo: https://github.com/withastro/astro/pull/11422

Changes

Before:

Redirects with schema defined in astro.config.mjs were converted into paths on the same site: https://google.com -> /https://google.com

After:

External redirects are detected and don't have the project base path prepended.

Testing

The output (esp. .vercel/output/config.json) of building a project with the updated integration was manually inspected.

A test was added

Docs

The Astro docs generally state that supporting external links configured through astro.config.mjs isn't a goal. While the Cloudflare adapter already supports external redirects, the Vercel adapter handled external redirects differently so far. Therefore this could potentially be considered a breaking change.

changeset-bot[bot] commented 1 month ago

🦋 Changeset detected

Latest commit: 6c06aba35d4e0653a91fe7c61e679baff8de9da7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 22 packages | Name | Type | | --------------------------------------------------------------- | ----- | | @astrojs/vercel | Minor | | @test/astro-vercel-basic | Patch | | @test/astro-vercel-function-per-route | Patch | | @test/astro-vercel-image | Patch | | @test/vercel-isr | Patch | | @test/vercel-max-duration | Patch | | @test/vercel-edge-middleware-with-edge-file | Patch | | @test/vercel-edge-middleware-without-edge-file | Patch | | @test/astro-vercel-no-output | Patch | | @test/astro-vercel-prerendered-error-pages | Patch | | @test/astro-vercel-redirects-serverless | Patch | | @test/astro-vercel-redirects | Patch | | @test/vercel-server-islands | Patch | | @test/astro-vercel-serverless-prerender | Patch | | @test/astro-vercel-serverless-with-dynamic-routes | Patch | | @test/astro-vercel-static-assets | Patch | | @test/astro-vercel-static | Patch | | @test/vercel-streaming | Patch | | @test/astro-vercel-with-speed-insights-enabled-output-as-server | Patch | | @test/astro-vercel-with-speed-insights-enabled-output-as-static | Patch | | @test/astro-vercel-with-web-analytics-enabled-output-as-static | Patch | | vercel-hosted-astro-project | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR