Apache Emulation Part 1

So the next objective we have is to start replacing Apache. We can do this by analyzing how Apache interacts with mod-jaxer. And if we can find out how to mimic Apache, then we can replace Apache with our own server.

const express = require('express');
const app = express();
const port = 8080;


app.get('*.html', function(req, res) {

        // attempt to read file and pass to jaxer


app.all('*/jaxer-include/*', function(req, res) {

        res.end('Server-only files');


app.post('/jaxer-callback', function(req, res) {

        // parse body and pass to jaxer


app.listen(port, function() {
        console.log(`Apache Emulator listening on port ${port}!`)

Using Express.js syntax, we can outline the functionality that Apache has right now. Which ends up not being very much. Going in order, when a file with the extension of .html is requested from Apache, then Apache will read the file and then pass it to Jaxer for processing, which will then return an http response which is then forwarded to the client browser.

Any files stored inside a folder name, jaxer-include are generally intended to be visible to only the server and shouldn’t be served to the client browser. So any urls with a jaxer-include directory in the path should be hidden from the end user. Generally with a response code such as 403 not authorized, or 404 not found.

And lastly the url /jaxer-callback is a set url where the client sends ajax requests to be processed by Jaxer. This callback uses the post method and includes parameters to the server in the request body. So we might need some logic to handle the http body, but otherwise this request should be similar to the .html handler where we take a request from the client, pass it to Jaxer, and then return the response.

In in terms of functionality, it doesn’t look like there is much to replicate, but we’ll see how the details work out as we go along. We have the layout, but next we will need to be able to monitor the interaction between Apache and Jaxer, so in the next blog we will create a proxy server that will allow us to view the packets sent and received between these two programs.