4 ms·
There's no need for additional software or third party complexity. Have your webserver create a custom logfile of HTTP POST to a certain url, ie POST to "exampl
by superkuh 2y ago
There's no need for additional software or third party complexity. Have your webserver create a custom logfile of HTTP POST to a certain url, ie POST to "example.com/feedback". Then write a static HTML snippet form that POSTs the comment content to that URL from the user's browser when they visit your webpage(s) and hit [submit]. Read this logfile with a text editor or do whatever you want. It should be possible with any webserver but I know it's possible with nginx.
No attack surface beyond spamming the log to cause filling up of disk space. But you can limit this by setting a max POST content size in nginx and a rate limit then doing a logrotate on the host OS.
No moving parts to fail or maintain. Just pure comment form.
- mmarian 2y agoOh my god that's actually brilliant!! I kept thinking about how to store the data, handle migrations, and I totally missed out that I could just write the whole damn thing to a file. Thank you!
- superkuh 2y agoIf you're actually interested he's a write up showing the nginx config tricks (like proxy passing to itself to get the POST contents), http://superkuh.com/blog/2020-01-10-1.html http://superkuh.com/blog/2020-01-10-1.html
- mmarian 2y agoCheers, what I'd probably do is the following: - use my Go/Gin server - host as a Docker container inside my Docker Swarm cluster managed by CapRover, so I don't have to pay for a new VM - given a request from a new origin, my server creates a log file with the origin name and writes the data - given a request from an existing origin, my server appends the data to the file - I expose an endpoint with an api key that serves all the contents of a file for a given origin Let me know if I missed something out though.
- mmarian 2y agoJust checked out your website by the way and wanted to say the comment system is really neat. Recommend everyone else to have a look.