0.0.2 • Published 2 years ago

@codeurs/n-proxy v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

n-proxy

Proxy all http requests to another process.

Node server example

<?php
require './node_modules/@codeurs/n-proxy/proxy.php';
forward(
  // Server will be started if not running
  'node server.js',
  // Port on which the server will listen
  3000,
  // A version string which triggers a restart if changed since last run
  (string) filemtime('server.js')
);

If running under apache, you can rewrite all requests to this file:

RewriteEngine on
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php [QSA,L]