Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] When using external IP from another device, styles are unaccessable #2449

Closed
3 tasks done
germaniuz opened this issue Sep 15, 2023 · 3 comments
Closed
3 tasks done
Labels
invalid This doesn't seem right

Comments

@germaniuz
Copy link

Agreement

Describe the issue

When I use external IP in dev mode from another device (phone for example) I get only page without any styles or scripts, because urls has my proxy domain (http://sq.test/wp/pathtothemestyles) not an external IP address. But that proxy domain is unaccessable from remote device via wifi.

My config:

/**
 * Compiler configuration
 *
 * @see {@link https://roots.io/docs/sage sage documentation}
 * @see {@link https://bud.js.org/guides/configure bud.js configuration guide}
 *
 * @param {import('@roots/bud').Bud} app
 */
export default async (app) => {
  /**
   * Application assets & entrypoints
   *
   * @see {@link https://bud.js.org/docs/bud.entry}
   * @see {@link https://bud.js.org/docs/bud.assets}
   */
  app
    .entry('app', ['@scripts/app', '@styles/app'])
    .entry('editor', ['@scripts/editor', '@styles/editor'])
    .assets(['images']);

  /**
   * Set public path
   *
   * @see {@link https://bud.js.org/docs/bud.setPublicPath}
   */
  app.setPublicPath('/app/themes/sage/public/');

  /**
   * Development server settings
   *
   * @see {@link https://bud.js.org/docs/bud.setUrl}
   * @see {@link https://bud.js.org/docs/bud.setProxyUrl}
   * @see {@link https://bud.js.org/docs/bud.watch}
   */
  app
    .setUrl(3000)
    .setProxyUrl('http://sq.test')
    .watch(['resources/views', 'app']);

  /**
   * Generate WordPress `theme.json`
   *
   * @note This overwrites `theme.json` on every build.
   *
   * @see {@link https://bud.js.org/extensions/sage/theme.json}
   * @see {@link https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-json}
   */
  app.wpjson
    .set('settings.color.custom', false)
    .set('settings.color.customDuotone', false)
    .set('settings.color.customGradient', false)
    .set('settings.color.defaultDuotone', false)
    .set('settings.color.defaultGradients', false)
    .set('settings.color.defaultPalette', false)
    .set('settings.color.duotone', [])
    .set('settings.custom.spacing', {})
    .set('settings.custom.typography.font-size', {})
    .set('settings.custom.typography.line-height', {})
    .set('settings.spacing.padding', true)
    .set('settings.spacing.units', ['px', '%', 'em', 'rem', 'vw', 'vh'])
    .set('settings.typography.customFontSize', false)
    .enable();
};

bud version 6.16.1

Expected Behavior

I expect my project loaded with styles and scripts on external device with external IP

Actual Behavior

I get page loaded without styles or scripts, because of the fact that url for styles is an proxy url, not external url

Steps To Reproduce

1.Install sage
2. Configure bud
3. run dev mode

version

6.16.1

Logs

No response

Configuration

No response

Relevant .budfiles

No response

@germaniuz germaniuz added the bug Something isn't working label Sep 15, 2023
@kellymears
Copy link
Contributor

You should proxy a network resolvable address for this use case; not something resolvable only from the host. You can use setPublicProxyUrl to ensure that internal links still resolve to the development server.

Something like:

bud
  .setProxyUrl('http://[host ipv4]')
  .setPublicProxyUrl('http://sq.test')

If we proxy all WordPress assets there are significant issues with the admin interface because of WordPress' handling of cookies and cross-origin resource loading.

Personally, I recommend using solutions like Android Studio and Simulator.

@germaniuz
Copy link
Author

germaniuz commented Sep 19, 2023 via email

@retlehs
Copy link
Member

retlehs commented Sep 24, 2023

Probably worth giving https://github.com/talss89/bud-localtunnel a shot for something like this

@retlehs retlehs closed this as not planned Won't fix, can't repro, duplicate, stale Sep 24, 2023
@retlehs retlehs added invalid This doesn't seem right and removed bug Something isn't working labels Sep 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants