Skip to content

Demo for using a NuxtJS server as a proxy to avoid CORS-related trouble when downloading files form an external server.

Notifications You must be signed in to change notification settings

maximoospital/download-proxy

Repository files navigation


NuxtJS v2 Download-Proxy

A simple way to avoid CORS trouble in your external downloads.

Table Of Contents

About The Project

Screen Shot

This is a solution to a (highly specific) problem i've had with NuxtJS v2, this being trying to get the server to serve me an external server's files as a download, while avoiding the CORS hijinks you'd run into with most solutions.

Built With

Getting Started

It's honestly pretty boilerplate stuff to get this demo working.

Prerequisites

You only need NPM, any other stuff you might need you can get it through npm install.

Installation

  1. Clone the repo
git clone https://github.com/maximoospital/download-proxy.git
  1. Install NPM packages
npm install
  1. Run it.
npm run dev

Usage

The way this works is pretty simple actually, the path /downloadImage is now assigned to the server middleware script ~/server-middleware/downloadImage.js, the way you can utilize this is by calling the path itself as /downloadImage/?url="YOUR LINK HERE" (without the quotation marks). Keep in mind, the way this avoids CORS is by proxying traffic itself through the NodeJS server, so it is meant for either light files like images or light traffic, it does cleanup after download.

Authors

  • Maximo Ospital - Junior Developer and CS Student - Maximo Ospital - i made this lol

Acknowledgements

About

Demo for using a NuxtJS server as a proxy to avoid CORS-related trouble when downloading files form an external server.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published