I have trouble working with Vite and Qwik behind a corporate proxy.
I am following the documentation and have this simple code
import { component$ } from '@builder.io/qwik';
import { routeLoader$ } from '@builder.io/qwik-city';
export const useDadJoke = routeLoader$(async () => {
const response = await fetch('https://icanhazdadjoke.com/', {
headers: { Accept: 'application/json' }
});
return (await response.json()) as {
id: string,
status: number,
joke: string
};
});
export default component$(() => {
const dadJokeSignal = useDadJoke();
return <section class="section bright">
<p>{dadJokeSignal.value.joke}</p>
</section>;
});
It works properly on my mobile network but as soon as I connect to my corporate network (with a proxy in place), the fetch
returns an ECONNREFUSED
response.
I've set HTTP_PROXY
, HTTPS_PROXY
, http_proxy
and https_proxy
environment variables to the proper proxy url but Vite seems to ignore that.
I've also tried to change the proxy
variable in vite.config.ts
, but from my understanding it is a reverse-proxy and won't do what I am trying to achieve. Anyway it seems like the property is ignored or I misconfigured it.
proxy: {
'*': {
target: 'my_proxy_url',
changeOrigin: false, // I've tried with true too, without success
proxyTimeout: 1000 * 60
}
}
Any idea how to use Vite & Qwik with the proxy?
Thanks for your help.