Proxy url on development build

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?

@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.

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

@Jacek
you are right, when website Run with

http://localhost:50190/wordpress/contact-us/
then it show

http://localhost/wordpress/contact-us

@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.

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.

@Jacek
did you try to add

process.env.MIX_SENTRY_DSN_PUBLIC

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.

3 Likes

this is a good solution. i’ll likely integrate this into @roots/bud-server in the next release.

3 Likes

Thank you @kellymears !