Wrangler preview --watch ignoring routes?

Hi all,

noticed that in wrangler preview --watch and ‘quick edit’ interfaces in workers admin, static file(images) serving is routed through worker, even though the routing is strictly set to specific url.

I have the console.log(event.request.url) line in my worker, and in browser’s console i find http://domain.com/imagefirst.jpg being logged. Though based on routing, it should not do this. In preview url field am setting exact domain (not wrangler.dev). Wrangler tail logs only exact url, what is expected.

Is it expected behaviour of preview environment?


The preview can run the script on any domain or route, since (I assume) it’s meant for testing the script on non-yet-pointed domains/routes - just like in the quick-edit in the CF console, you can enter any URL into the preview window.

Thomas, many thanks for prompt response. That makes sense. And just to wrap up what you said - the fact that in preview you can enter any domain means in preview environment worker script acts as a middleware, to which all requests(including static files) are sent and from where all responses are served?

Thanks! :slight_smile:

Exactly! This makes it possible to test the html-rewriter as well.

1 Like

Thanks again, Thomas, for your help!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.