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

_image endpoint returning a 404 for local images #8735

Closed
1 task
jdtjenkins opened this issue Oct 3, 2023 · 4 comments · Fixed by #8828
Closed
1 task

_image endpoint returning a 404 for local images #8735

jdtjenkins opened this issue Oct 3, 2023 · 4 comments · Fixed by #8828
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: assets Related to the Assets feature (scope)

Comments

@jdtjenkins
Copy link

Astro Info

Astro                    v3.2.2
Node                     v18.16.1
System                   Windows (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             @astrojs/tailwind
                         @astrojs/svelte
                         @storyblok/astro

If this issue only occurs in one browser, which browser is a problem?

Chrome

Describe the Bug

After enabling the Vite Basic SSL plugin (@vitejs/plugin-basic-ssl) and serving my local dev on https my images that are stored within the src folder are returning a 404 when trying to load from the _image endpoint.

What's the expected result?

The endpoint should return a 200 and the image should show.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-x9jtgg https://codesandbox.io/p/sandbox/condescending-mirzakhani-8qpy34 ------ I have added a stackblitz link that won't run dev and a codesandbox that will run dev but not connect! So I didn't know what to do. They both break because of the ssl plugin but the code is there

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Oct 3, 2023
@jdtjenkins
Copy link
Author

Also forgot to include this in the issue but my image and vite config are here:

// astro.config.mjs

{
...,
image: {
    domains: [
      'localhost',
      'storyblok.com',
    ],
    remotePatterns: [
      {
        protocol: 'https',
        hostname: '**.storyblok.com',
      },
      {
        protocol: 'https',
        hostname: 'localhost',
        port: '4321',
        pathname: '/*',
      },
    ],
  },
  vite: {
    plugins: [
      basicSsl()
    ],
    server: {
      https: true,
    },
  }
}

@Princesseuh Princesseuh added - P3: minor bug An edge case that only affects very specific usage (priority) feat: assets Related to the Assets feature (scope) and removed needs triage Issue needs to be triaged labels Oct 3, 2023
@Princesseuh
Copy link
Member

Tried the repro locally and everything works for me on macOS, so this could be a Windows issue maybe

@andrejilderda
Copy link

@Princesseuh
Copy link
Member

@Princesseuh Could it be that this line:
astro/packages/astro/src/assets/endpoint/node.ts at 90d70eb7c4ceddf7246e338100e01de7dc8756f6 · withastro/astro

Needs a similar workaround for Windows as this one:
unix/astro-https-image-endpoint#2

Ah yes, probably. I might've gotten tripped up with the fact that this previously only handled URLs and not file paths

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: assets Related to the Assets feature (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants