Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nuxtjs/proxy

Package Overview
Dependencies
Maintainers
4
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nuxtjs/proxy

The one-liner node.js http-proxy middleware solution for Nuxt.js using http-proxy-middleware

  • 1.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
154K
decreased by-0.77%
Maintainers
4
Weekly downloads
 
Created

What is @nuxtjs/proxy?

@nuxtjs/proxy is a Nuxt.js module that allows you to easily configure proxy middleware for your Nuxt.js application. This is particularly useful for handling API requests during development, avoiding CORS issues, and routing requests to different backends.

What are @nuxtjs/proxy's main functionalities?

Basic Proxy Setup

This feature allows you to set up a basic proxy configuration. In this example, any request to `/api/` will be proxied to `http://api.example.com`, and the `/api/` prefix will be removed from the request path.

json
{
  "modules": [
    "@nuxtjs/proxy"
  ],
  "proxy": {
    "/api/": {
      "target": "http://api.example.com",
      "pathRewrite": { "^/api/": "" }
    }
  }
}

Multiple Proxies

This feature allows you to set up multiple proxy configurations. In this example, requests to `/api/` are proxied to `http://api.example.com`, and requests to `/auth/` are proxied to `http://auth.example.com`.

json
{
  "modules": [
    "@nuxtjs/proxy"
  ],
  "proxy": {
    "/api/": {
      "target": "http://api.example.com",
      "pathRewrite": { "^/api/": "" }
    },
    "/auth/": {
      "target": "http://auth.example.com",
      "pathRewrite": { "^/auth/": "" }
    }
  }
}

Custom Proxy Options

This feature allows you to customize proxy options. In this example, `changeOrigin` is set to `true` to change the origin of the host header to the target URL, and `secure` is set to `false` to allow self-signed SSL certificates.

json
{
  "modules": [
    "@nuxtjs/proxy"
  ],
  "proxy": {
    "/api/": {
      "target": "http://api.example.com",
      "pathRewrite": { "^/api/": "" },
      "changeOrigin": true,
      "secure": false
    }
  }
}

Other packages similar to @nuxtjs/proxy

FAQs

Package last updated on 30 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc