sternenseemann / spacecookie

gopher library & server written in Haskell
https://sternenseemann.github.io/spacecookie/
GNU General Public License v3.0
47 stars 5 forks source link

Reverse proxy #58

Open someodd opened 5 months ago

someodd commented 5 months ago

On my server I have two different gopherholes I want to expose to the world. Currently they run on different ports. I'd like to be able to configure spacecookie to act as a reverse proxy to sort incoming gopher requests to a configured gopherhole. For example, a simple configuration could be detecting the base directory of "forum/" in the selector and forwarding selector to a configured gopherhole and sending its response back.

I suppose all I really want is the ability to have spacecookie map certain base directories to certain gopherholes, and everything can be communicated via a consistent port.

Would you like me to work on a PR for this concept? Would you like to implement?

I'm posting using my phone and sorry if my English is poor.

sternenseemann commented 5 months ago

This feature is not a goal for me for the spacecookie server binary that the cabal package exposes. However, the exposed library is pretty flexible, so it should be possible to implement something like this by depending on spacecookie as a library in a separate package.

I'd be happy to accept contributions to the library that fill any obvious gaps (e.g. serializing received requests again into the wire format), but I don't think it necessarily fits into the server binary. It was meant as a showcase for the library (that it can implement a “competent” server daemon), but advanced, dynamic use cases should rely on the library interface (which is kind of unique to spacecookie anyways).

someodd commented 5 months ago

Thank you, this makes sense to me. Maybe you can add section of readme for notable projects which may be useful for others, if I do decide to make a reverse proxy type thing? I'm not sure if you have seen that I made gopherden and it uses spacecookie, which was delightful to work with. Thank you

Also, are you on Mastodon?