HeaderApp is a Node.js application that mirrors all request headers sent to it. It is built to be both directly deployed to an environment as well as containerized in Docker to allow for more universal deployment.
- Mirrors all request headers sent to the application.
- Supports both GET and POST requests.
- Can be deployed directly or as a Docker container.
- Can support HTTP and HTTPS
- Node.js (version 22 or higher)
- Docker (for containerized deployment)
-
Clone the repository:
git clone https://github.com/Adal8819/headerapp.git cd headerapp -
Install dependencies:
npm install
-
Start the application:
npm start
-
The application will be running on http://localhost:3000.
-
Clone the repository:
git clone https://github.com/Adal8819/headerapp.git cd headerapp -
Build the Docker image:
docker build -t headerapp . -
Run the Docker container:
docker run -p 8080:8080 headerapp
-
The application will be running on http://localhost:8080
-
Clone the repository:
git clone https://github.com/Adal8819/headerapp.git cd headerapp -
Install dependencies:
npm install
-
Make sure that your SSL Certificates are in place. The application is designed to work with an unencrypted SSL key currently.
-
Update the .ENV file to utilize SSL
SSL_KEY=./ssl/private/leaf.key SSL_CERT=./ssl/private/chain.cer USESSL=true PORTHTTPS=8443 PORTHTTP=8080 -
Start the application:
npm start
-
The application will be running on http://localhost:8080 and https://localhost:8443.
-
Clone the repository:
git clone https://github.com/Adal8819/headerapp.git cd headerapp -
Make sure that your SSL Certificates are in place. The application is designed to work with an unencrypted SSL key currently.
-
Update the .ENV file to utilize SSL
SSL_KEY=./etc/ssl/leaf.key SSL_CERT=./etc/ssl/chain.cer USESSL=true PORTHTTPS=8443 PORTHTTP=8080 -
Build the Docker image:
docker build -t headerapp . -
Run the Docker container you need to make sure that you are mounting in the SSL Certificates into the appropriate directory for SSL to function:
docker run -v 'C:/path/to/your/ssl/files:/etc/ssl/certs' -p 8080:8080 -p 8443:8443 headerapp -
The application will be running on http://localhost:8080 and https://localhost:8443
Headerapp uses a .ENV file to house configurable values. There are several values that can be configured there. Below lists out the configurable values and what they control.
| Keys | Accepted Values | Definitions |
|---|---|---|
| SSL_KEY | string | This is the path defined to the SSL private key file. Currently the application expects the key file to be stored in plain text |
| SSL_CERT | string | This is the path defined to the SSL public key file |
| USESSL | boolean | This enables or disables TLS. If this is set the SSL_KEY and SSL_CERT values must be defined. |
| PORTHTTPS | interger | This defines the HTTPS port. It is only used if the USESSL flag is set to true. If this is not set the applicatino will default to 8443. |
| PORTHTTP | interger | This defines the HTTP port. If this is not set the application will default to 8080. |
| DEBUG | boolean | This enables HTTP request debug logging to write to the console. This can be useful if you are troubleshooting what the application is seeing. |
Below is a sample .ENV file
SSL_KEY=./ssl/private/leaf.key
SSL_CERT=./ssl/private/chain.cer
USESSL=true
PORTHTTPS=8443
PORTHTTP=8080
DEBUG=true
Send a GET or POST request to the application, and it will respond with the request headers.
Example:
curl -X GET http://localhost:3000Response:
{
"method": "GET",
"url": "/",
"clientIP": "::1",
"headers": {
"host": "localhost:3000",
"user-agent": "curl/7.68.0",
"accept": "*/*"
}
}This project uses GitHub Actions to build and push the Docker image to GitHub Container Registry for ease of deployment. The workflow is defined in .github/workflows/container-build.yml
This application is a sample application. The sample is provided "as is" without warranty of any kind. This is not intended to be run in any production environment and is intended only as a testing and troubleshooting tool.