https://github.com/john-doherty/express-public-url
Parses HTTP headers to generate the correct public url a node app behind a proxy such as nginx
https://github.com/john-doherty/express-public-url
express nginx nodejs
Last synced: about 1 month ago
JSON representation
Parses HTTP headers to generate the correct public url a node app behind a proxy such as nginx
- Host: GitHub
- URL: https://github.com/john-doherty/express-public-url
- Owner: john-doherty
- License: isc
- Created: 2018-05-25T09:44:16.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-12-29T17:57:02.000Z (over 4 years ago)
- Last Synced: 2025-10-27T16:56:02.156Z (7 months ago)
- Topics: express, nginx, nodejs
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# express-public-url
This little module adds `req.urlBase` and `req.publicUrl` to your express routes to make it easy to get the incoming request URL regardless of where you app us running - behind a proxy, load-balancer etc.
## Installation
```bash
npm install --save express-public-url
```
## Usage
```js
var express = require('express');
var app = express();
// require module
var expressPublicUrl = require('express-public-url');
// add middleware to get the public Url from either the http proxy headers or current request host
app.use(expressPublicUrl());
```
## History
For change-log, check [releases](https://github.com/john-doherty/express-public-url/releases).
## License
Licensed under [MIT License](LICENSE) © [John Doherty](https://twitter.com/mrjohndoherty)