NuxtN
Nuxt9mo ago
23 replies
Sʅαԃҽ

How to support external assets properly ?

Hello,

I do have my application running properly using the ~/assets url for my embedded content and the rest in the public folder. Which is fine for my "static assets".
However for my product images and such, they are uploaded in the admin by various clients. Those images are stored on S3.
Previously in angular/aurelia/react and such frameworks i was not doing SSR and used a reverse-proxy nginx config to redirect anything starting with "/cdn" to "http://myapp.assets.s3-eu-west-1.amazonaws.com/"
Which worked fine.

However i'm struggling to replicate this with NUXT. I did skip the nginx config as this time i use node_server it's not just static website anymore. I run everything using a docker-compose file and traefik.
I guess I could instead map my URL to a nginx instance first which would reverse-proxy each URL to either the CDN or NUXT instance but it requires to add another layer and I would rather avoid unless required. Is there any embedded support for reverse-proxy ?
What i would like is that when any URL has the "/cdn/" prefix it should be redirected to "http://myapp.assets.s3-eu-west-1.amazonaws.com/" instead. ipx should not process it either etc...

I guess I could also using something like a pipe/value-converter equivalent in vue (not yet familiar with that) but it would require tu put it everywhere external assets are required. I would like it to be as transparent as possible.

Thank a lot for the help
Was this page helpful?