502 Bad Gateway Error When Using HTTP Proxy with `shopify theme dev`
Please confirm that you have:
- [x] Searched existing issues to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
- [x] Reproduced the issue in the latest CLI version.
In which of these areas are you experiencing a problem?
Theme
Expected behavior
The CLI should successfully render the storefront through the configured HTTP proxy.
Actual behavior
The CLI fails to render the storefront with a 502 Bad Gateway error, despite proper proxy configuration.
Verbose output
Verbose output
Failed to render storefront with status 502 (Bad Gateway).
URL: [REDACTED]
TypeError: fetch failed
at node:internal/deps/undici/undici:13510:13
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async render2 [...]
at async Object.handler [...]
at async Server.<anonymous> [...]
Reproduction steps
1.Set HTTP proxy environment variables:
$env:SHOPIFY_HTTP_PROXY = "http://127.0.0.1:PORT"
$env:SHOPIFY_HTTPS_PROXY = "http://127.0.0.1:PORT"
2.Run shopify theme dev -e development
3.CLI starts successfully and provides preview URLs
4.Immediately encounters 502 Bad Gateway error
### Operating System
Windows 11
### Shopify CLI version (`shopify --version`)
@shopify/cli/0.0.0-snapshot-20250313171017
### Shell
powershell
### Node version (run `node -v` if you're not sure)
v22.15.1
### What language and version are you using in your application?
_No response_
I have the exact same error here. Log output identical to @reeswell.
- WSL 2 on Windows 10
- @shopify/cli/3.80.7 wsl-x64 node-v24.1.0
I have the exact same error here. Log output identical to @reeswell.
- WSL 2 on Windows 10
- @shopify/cli/3.80.7 wsl-x64 node-v24.1.0
Removing a plugin through shopify plugin reset solved the issue for me.
I have the exact same error here. Log output identical to @reeswell.
- WSL 2 on Windows 10
- @shopify/cli/3.80.7 wsl-x64 node-v24.1.0
Removing a plugin through
shopify plugin resetsolved the issue for me.
Thank you for your response. However, when I tried shopify plugins reset, it shows "Found 0 plugin" and the issue still persists.
Here's what I've tried:
- Ran
shopify plugins reset-> Result: "Found 0 plugin" - Completely uninstalled and reinstalled Shopify CLI
- Cleared npm cache and configurations
My environment:
- WSL 2 on Windows 11
- @shopify/cli/3.53.0
- Node.js v22.15.1
-
- Theme: Liquid theme
Do you have docs for the SHOPIFY_HTTP_PROXY? Couldn't find anything.
Looks l like a CLI core/kit issue
Do you have docs for the SHOPIFY_HTTP_PROXY? Couldn't find anything.
#5520
Same error, How did you finally solve it?
Same error, Is there any solution for this?
Same error. Any update for this issue?
I am also having this problem. I'm commenting so I get notifications if an answer pops up.
This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.
P.S. You can learn more about why we stale issues here.
Facing the same issue
same issue here
I haven't found solution for the issue but here's a workaround. Run shopify theme dev and click Share your theme preview instead of http://127.0.0.1:9292 . This has been working smoothly for me. Although you will loose hot reloading and will have to refresh the page manually everytime you want to see your changes.
Less likely fixes:
Install Cloudflare WARP. It resolves DNS through a secure tunnel. Might be useful in the countries with nationwide firewalls which can interfere with DNS resolution.
I was using WSL (ubuntu) in windows for development. WSL was using different network card than my windows. I modified .wsl config to make it use same network card as windows.
Thanks all! I think we understand this a little bit better. Some core functionality was added to the CLI to support SHOPIFY_HTTP(S)_PROXY but individual packages (theme in this case) need to implement support for this individually.
- Original PR: https://github.com/Shopify/cli/pull/5520
- Hydrogen adopting it: https://github.com/Shopify/hydrogen/pull/2831
We'll be looking into adding better support for this with theme commands in the near future.