rhttp/config.js

37 lines
831 B
JavaScript

export default {
port: 8080,
sites: {
"api.example.com": {
hostname: "api.example.com",
routes: [
{
type: "reverse_proxy",
path_pattern: "/v1/*",
target: "http://localhost:3001",
rewrite: {
pattern: "^/v1",
replacement: "/api/v1"
}
}
]
},
"static.example.com": {
hostname: "static.example.com",
routes: [
{
type: "static",
path_pattern: "/*",
root: "./static",
index: ["index.html"]
}
]
}
},
// JavaScript middleware example
middleware: async function(req) {
console.log(`Request: ${req.method} ${req.url}`);
// Return null to continue processing, or return a Response to directly respond
return null;
}
};