Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maximoospital/download-proxy
Demo for using a NuxtJS server as a proxy to avoid CORS-related trouble when downloading files form an external server.
https://github.com/maximoospital/download-proxy
axios cors download nuxtjs nuxtjs-template nuxtjs2 proxy v2
Last synced: about 1 month ago
JSON representation
Demo for using a NuxtJS server as a proxy to avoid CORS-related trouble when downloading files form an external server.
- Host: GitHub
- URL: https://github.com/maximoospital/download-proxy
- Owner: maximoospital
- Created: 2024-01-19T22:19:46.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-06-17T16:50:20.000Z (6 months ago)
- Last Synced: 2024-06-17T18:58:23.606Z (6 months ago)
- Topics: axios, cors, download, nuxtjs, nuxtjs-template, nuxtjs2, proxy, v2
- Language: Vue
- Homepage:
- Size: 167 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
NuxtJS v2 Download-Proxy
A simple way to avoid CORS trouble in your external downloads.
## Table Of Contents
* [About the Project](#about-the-project)
* [Built With](#built-with)
* [Getting Started](#getting-started)
* [Prerequisites](#prerequisites)
* [Installation](#installation)
* [Usage](#usage)
* [Authors](#authors)
* [Acknowledgements](#acknowledgements)## About The Project
![Screen Shot](images/screenshot.png)
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
* [NuxtJS v2](https://v2.nuxt.com/)
* [@nuxtjs/axios](https://axios.nuxtjs.org/)## 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
```sh
git clone https://github.com/maximoospital/download-proxy.git
```2. Install NPM packages
```sh
npm install
```3. Run it.
```sh
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](https://github.com/maximoospital/) - *i made this lol*
## Acknowledgements
* [ShaanCoding for this awesome Readme's generator](https://github.com/ShaanCoding/)