Skip to content

Do not deprecate wrangler's proxy feature, e.g. wrangler pages dev -- vite or keep at least the injection part with a new api such as wrangler inject -- vite #5315

@newsve

Description

@newsve

Edit: I edited the issue title since this thread has been evolved about how to inject CF env vars into a hot reloading dev server, the actual issue is further down: #5315 (comment)

Which Cloudflare product(s) does this pertain to?

Pages

What version(s) of the tool(s) are you using?

3.35.0

What version of Node are you using?

v20.11.1

What operating system and version are you using?

Ubuntu 22.04.2 LTS

Describe the Bug

Observed behavior

When the app redirects wrangler pages dev does the redirect but the URL in the browser's URL bar doesn't change (or redirect's header lacks the redirect status and new URL and the response header lacks a location header.

This is a big problem because it breaks relative links on redirected pages and doesn't reflect production.

Expected behavior

A proper redirect with URL change and proper headers

Steps to reproduce

git clone https://github.com/newsve/wrangler-no-redirect.git
npm i
npm run dev

In your browser go first to localhost:5713 which is the og SvelteKit/Vite server without wrangler, you see a redirect happng to localhost:5713/some-random-page. Now try the same with localhost:8788 which is via wrangler, still redirects but the URL in the URL bar does not change.

Also check and compare the headers (left: 5713, right 8788), note that the 8788 one lacks a response location header:

image

Please provide a link to a minimal reproduction

git clone https://github.com/newsve/wrangler-no-redirect.git

Please provide any relevant error logs

No response

Metadata

Metadata

Labels

bugSomething that isn't workingpagesRelating to Pages

Type

No type

Projects

Status

Backlog

Relationships

None yet

Development

No branches or pull requests

Issue actions