Add reverse-proxy functionality
mufeedvh opened this issue ยท 0 comments
mufeedvh commented
@luciusmagn suggested this feature, Thank You! ๐
i.e. rerouting domains and routes to different ports on the machine
Multiple domains are not handled at the moment, I will probably think about adding this.
Implementation
Here is how I am planning to implement this feature.
The configuration will look like this, just use a hostname:port
combination instead of static file route to configure. simple.
"routes": {
"/": "index.html",
"/example": "example.html",
"/blog": "blog.example.com",
"/staging": "blog.example.com:8080"
},
While checking for routes, it reads the file (NamedFile()
) and responds with the corresponding Content-Type
at the moment, this feature should require a check for hostname/file validation before the response.
SIDE NOTE: This might be expensive in performance, in-memory/cached handling of the configuration would be a workaround?