Dev URL responding with 301 'Site Moved'

My dev URL is responding with a 301 redirect. When I curl my dev url, I see an HTML template an nginx response saying the site has been permanently moved.

I’ve seen others have had similar issues in earlier versions of Sage – before Bud – but none of the solutions have fixed my issue.

I know I am messing up something in my config file, but I don’t know what.

Here is what I have:

export default async (app) => {
  /**
   * Application entrypoints
   * @see {@link https://bud.js.org/docs/bud.entry/}
   */

  app
    .entry({
      app: ['@scripts/app','@scripts/navDropdown', '@styles/app'],
      editor: ['@scripts/editor', '@styles/editor'],
    })

    /**
     * Directory contents to be included in the compilation
     * @see {@link https://bud.js.org/docs/bud.assets/}
     */
    .assets(['images'])

    /**
     * Matched files trigger a page reload when modified
     * @see {@link https://bud.js.org/docs/bud.watch/}
     */
    .watch(['resources/views/**/*', 'app/**/*'])

    /**
     * Proxy origin (`WP_HOME`)
     * @see {@link https://bud.js.org/docs/bud.proxy/}
     */
    .proxy(new URL('http://fhcnyc.test'))

    /**
     * Development origin
     * @see {@link https://bud.js.org/docs/bud.serve/}
     */
    .serve(new URL('http://dev.fhcnyc.test:3000'))

    /**
     * URI of the `public` directory
     * @see {@link https://bud.js.org/docs/bud.setPublicPath/}
     */
    .setPublicPath('/app/themes/sage/public/')

    /**
     * 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/}
     */
    .wpjson.settings({
      color: {
        custom: false,
        customDuotone: false,
        customGradient: false,
        defaultDuotone: false,
        defaultGradients: false,
        defaultPalette: false,
        duotone: [],
      },
      custom: {
        spacing: {},
        typography: {
          'font-size': {},
          'line-height': {},
        },
      },
      spacing: {
        padding: true,
        units: ['px', '%', 'em', 'rem', 'vw', 'vh'],
      },
      typography: {
        customFontSize: false,
      },
    })
    .useTailwindColors()
    .useTailwindFontFamily()
    .useTailwindFontSize()
    .enable();
};

1 Like

Solved. Looks like the proxy URL was set up as a redirect to the canonical url in group_vars/development/wordpress_sites.yml. (I am using Trellis v1.9.0) This must have been causing the dev URL to also redirect.

I removed the redirect and set the canonical as the proxy. That seems to have fixed the issue. Did a quick test and hot reload is working.

1 Like