Socket
Socket
Sign inDemoInstall

@nuxtjs/proxy

Package Overview
Dependencies
91
Maintainers
4
Versions
17
Alerts
File Explorer

Advanced tools

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


Version published
Maintainers
4
Install size
4.01 MB
Created

Changelog

Source

1.3.1 (2018-10-30)

Bug Fixes

  • add hint for "universal" mode only (#10) (c78b122)

<a name="1.3.0"></a>

Readme

Source

Proxy Module

npm (scoped with tag) npm CircleCI Codecov Dependencies js-standard-style

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

📖 Release Notes

✨ Do you know that Axios Module has built in support for Proxy Module?

Features

✓ Path rewrites

✓ Host based router (useful for staging/test)

✓ Logs / Proxy Events

✓ WebSockets

✓ Auth / Cookie

✓ ...and more! (see http-proxy-middleware docs)

⚠ Does not work in generated/static mode!

Setup

  • Add @nuxtjs/proxy dependency using yarn or npm to your project
  • Add @nuxtjs/proxy to modules section of nuxt.config.js
{
  modules: [
    // Simple usage
   '@nuxtjs/proxy',

   // With options
   ['@nuxtjs/proxy', { pathRewrite: { '^/api' : '/api/v1' } }],
  ]
}
  • Define as many as proxy middleware you want in proxy section of nuxt.config.js (See proxy section below)

Options

  • changeOrigin and ws options are enabled by default.

[optional] You can provide default options to all proxy targets by passing options to module options.

proxy

You can provide proxy config using either object or array.

Array mode

You can use magic shorthands

{
  proxy: [
    // Proxies /foo to http://example.com/foo
    'http://example.com/foo',

    // Proxies /api/books/*/**.json to http://example.com:8000
    'http://example.com:8000/api/books/*/**.json',

    // You can also pass more options
    [ 'http://example.com/foo', { ws: false } ]
  ]
}

Object mode

Keys are context

{
  proxy: {
      // Simple proxy
      '/api': 'http://example.com',

      // With options
      '/api2': { target: 'http://example.com', ws: false }
  }
}

License

MIT License

Copyright (c) Nuxt Community - Pooya Parsa pooya@pi0.ir

FAQs

Last updated on 30 Oct 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc