Jacek
March 8, 2022, 11:39am
1
Hey,
On development mode, sage return proxy path.
/**
* Target URL to be proxied by the dev server.
*
* This is your local dev server.
*/
.proxy('http://test.local')
/**
* Development URL
*/
.serve('http://test.local:3000');
};
Links in theme on development mode should return for example:
http://test.local:3000/about-us
but I have:
http://test.local/about-us
anyone have a similar issue?
vipul
March 9, 2022, 10:27am
2
@Jacek
when I was run, it was give me proxy URL not found that reason I was comment below line.
// .serve(‘http://test.local:3000 ’);
that was work for me.
Jacek
March 9, 2022, 10:35am
3
Hey @vipul
I’ve commented this line too, but still no success.
Could you check on some page in dev mode what php return in url on your side?
@php
global $wp;
echo home_url( $wp->request )
@endphp
On my side, I have proxy url but should be localhost:port
vipul
March 9, 2022, 11:02am
4
vipul
March 9, 2022, 11:51am
5
@Jacek
Wp URL is work base on Wp-option table, can you please check what is home page and site url I wp-option table.
Jacek
March 9, 2022, 12:06pm
6
I think it should return localhost in path as laravel mix do. Right now it’s hard to work with forms, ajax everywhere where urls should be handled.
vipul
March 9, 2022, 12:28pm
7
@Jacek
did you try to add
process.env.MIX_SENTRY_DSN_PUBLIC
Jacek
March 10, 2022, 5:47pm
8
If somebody in the future will try to find solution how to handle it. Below function will replace proxy url’s in theme to localhost urls (.serve url) in development mode. Helpful for pjax or similar library.
gistfile1.txt
async function UrlChanger() {
const { headers } = await fetch(window.location.origin, {
method: 'GET',
})
const origin = {
proxy: headers.get('x-bud-proxy-origin'),
dev: headers.get('x-bud-dev-origin'),
This file has been truncated. show original
3 Likes
this is a good solution. i’ll likely integrate this into @roots/bud-server
in the next release.
3 Likes