-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Local image assets not found when using https:// #8395
Comments
Adding my vote to this issue. We need HTTPS on the web frontend due to CORS (server API being called only allows https), and so having this capability would definitely be very useful. Right now, we have to run the API related components with images showing as broken and then test the images separately by disabling https. |
@ak-en This is very similar to my case. 👍 |
Also having this issue with a similar case to @ak-en. Trying to use Storyblok's visual editor with Astro but Storyblok requires HTTPS. |
I created a repo (astro-https-image-endpoint) to solve this issue, maybe it will help you guys out. Now it works fine for me locally and will be automatically disabled in production. (If there are any issues with deployment, you can simply comment out the configuration.) // astro.config.mjs
import imageEndpoint from 'astro-https-image-endpoint'
export default defineConfig({
// ... your configs
image: {
endpoint: imageEndpoint(import.meta.env.DEV),
},
}) |
Awesome work using 3.1's new feature for setting a custom endpoint! I made it exactly for this purpose. Hoping to build a similar solution in Astro itself very soon |
Will try it out! |
✨ Works like a charm, thanks a lot @unix . Great workaround for now! Feel free to close this issue @Princesseuh . |
@unix, I tried it today but did not work. Here is what I did:
My vite config is as below (the key and cert files referred have been generated and work fine to run locally with https):
Does the host='0.0.0.0' have any incompatibility with I am on node 18.17.1 - is a newer version needed? |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
Astro image assets return a 404
Not Found
when runningastro dev
with Vite's (dev) server set tohttps: true
.The reproduction is using
@vitejs/plugin-basic-ssl
, which is Vite's recommended way of running a dev server with https.I also tried running the dev server without https and proxy the requests separately, but this results in the same error (if needed I can provide the reproduction for this as well).
What's the expected result?
I expected the image to display properly.
Link to Minimal Reproducible Example
https://github.com/andrejilderda/astro-local-https-assets-issue
Participation
The text was updated successfully, but these errors were encountered: