Nuxt Module

โšก nuxt-proxy-request

HTTP Proxy for Nuxt โ€” powered by h3-proxy

Seamlessly proxy API requests in both development and production environments. No more http-proxy-middleware compatibility issues.

๐ŸŽฏ

Multiple Targets

Proxy to different backends โ€” each with its own rules, rewrites, and headers.

โœ‚๏ธ

Path Rewrite

Strip or transform URL prefixes before forwarding requests upstream.

๐Ÿ”

Header Injection

Inject custom auth tokens or metadata via configureProxyRequest.

โš™๏ธ

Function Filters

Advanced path matching with function-based pathFilter and method checks.

GETPOST Users API

Proxied: /api/users/** โ†’ jsonplaceholder.typicode.com/users/** ย ยทย  Rule: pathRewrite ^/api โ†’ ''

๐Ÿ‘† Click a button above to test the Users proxy rule

GET Posts API

Proxied: /api/posts/** โ†’ jsonplaceholder.typicode.com/posts/** ย ยทย  Demonstrates multiple proxy targets

๐Ÿ‘† Click a button above to test the Posts proxy rule

GETPOST Echo / Header Inspection

Proxied: /api/echo/** โ†’ httpbin.org/anything ย ยทย  Demonstrates configureProxyRequest with custom headers: X-Proxy-Auth, X-Request-Source, X-Proxy-Version

๐Ÿ‘† Click a button above to test header injection via configureProxyRequest

GET Function-Based Path Filter

Proxied: /api/filter/** โ†’ httpbin.org/anything ย ยทย  Demonstrates function-based pathFilter โ€” only proxies GET requests matching /api/filter/.*

๐Ÿ‘† Try both buttons โ€” observe that POST is blocked by the function filter

Active Proxy Configuration

Defined in playground/nuxt.config.ts via the proxy config key

Rule 1
Targethttps://jsonplaceholder.typicode.com
pathFilter['/api/users/**']
pathRewrite{ '^/api': '' }
Rule 2
Targethttps://jsonplaceholder.typicode.com
pathFilter['/api/posts/**']
pathRewrite{ '^/api': '' }
Rule 3
Targethttps://httpbin.org
pathFilter['/api/echo/**']
pathRewrite{ '^/api/echo': '/anything' }
configureProxyRequestActive โ€” injects custom headers
Rule 4
Targethttps://httpbin.org
pathFilterfunction(path, req) { ... }
pathRewrite{ '^/api/filter': '/anything' }
configureProxyRequestActive โ€” injects custom headers