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

define base domain other then localhost #137

Closed
pixelpaulaus opened this issue Jan 5, 2021 · 7 comments · Fixed by #348
Closed

define base domain other then localhost #137

pixelpaulaus opened this issue Jan 5, 2021 · 7 comments · Fixed by #348
Labels
question Further information is requested

Comments

@pixelpaulaus
Copy link

how can i change it so it does not fetch the image via localhost, but instead a specified domain/IP?

Copy link
Member

Atinux commented Jan 6, 2021

In the upcoming version you will be able to specify which domains you want to accept

@pixelpaulaus
Copy link
Author

sound good, thanks.
what do you mean by domains you want to accept exactly?
i was more talking about the dev domain where the images are loaded from (IPX), instead of localhost.
expected release on version?

@pi0
Copy link
Member

pi0 commented Jan 8, 2021

@pixelpaulaus Input URLs for IPX, can be either relative (served from static dir) or a URL. Do you want to host resizer service instead of locally starting ipx with nuxt dev?

Copy link
Member

@pixelpaulaus Any update on your use-case?

@danielroe danielroe added the question Further information is requested label Apr 29, 2021 — with Volta.net
@thomas4Bitcraft
Copy link

@danielroe It would be good if you can add a remote image without having to specify the domain as it is not the best way in terms of SEO. Maybe you could pass a default domain to nuxt/image, which is used if no domain is specified?

@pi0
Copy link
Member

pi0 commented May 18, 2021

URL shortening with default domain seems a good use case. (I've escalated this to unjs/ipx#32).

Still, we need to specify domains in nuxt.config (at least by default and for non-static provider) because otherwise, it makes ipx an open proxy accepting any host.

For non SEO purposes (clean/dynamic code), we can use presets to define baseURL.

Example: https://codesandbox.io/s/lively-feather-uwhmz

//nuxt.config
export default {
  buildModules: ["@nuxt/image"],
  image: {
    domains: ["https://picsum.photos"],
    presets: {
      picsum: {
        baseURL: "/_ipx/https://picsum.photos/id/"
      }
    }
  }
};
<template>
  <main>
    <nuxt-img preset="picsum" src="10/500" />
  </main>
</template>

@pi0 pi0 mentioned this issue Jul 1, 2021
@pi0 pi0 closed this as completed in #348 Jul 1, 2021
@pi0
Copy link
Member

pi0 commented Jul 1, 2021

Server alias support added in 0.5.0. See documentation: https://image.nuxtjs.org/api/options#alias

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants