External HTTP Post Request

1. The problem I’m having:

Hello everyone, I hope I can explain my problem to you clearly. I am an absolute beginner when it comes to caddy, web server etc.
In my work I got the following topic with the following condition and I don’t know how to start and what I have to configure or how such a config should look optimally.

The status and my goal:
Externally there is a form server that can send the forms with attachments with an HTTP Post mulitpart request. There I can specify an HTTP path where it should deliver the files with username and password.

I would like to use Caddy so that it can accept the HTTP Post Requests and for test purposes store the documents that come in via HTTP Post Request in a directory of its own.

So much for the status or my goal.

2. Error messages and/or full log output:

I don’t have an error log at the moment because I don’t know how to configure the theme. I would like to contribute more. I have only installed Caddy on CentOS so far and the basic config works. With Curl localhost I get Hello World without errors

Please use the preview pane to ensure it looks nice.

3. Caddy version:

My Caddy Version: v2.7.6

4. How I installed and ran Caddy:

I have so far carried out the basic installation as you can find it on the Caddy homepage. As described, unfortunately I have so little idea. I gratefully accept every pattern or instruction and every piece of information is absorbed like a sponge so that I can grow and learn from it.

a. System environment:

I got a CentOS 7 VM Client

b. Command:

Standard Commands for a basic install

Please use the preview pane to ensure it looks nice.

c. Service/unit/compose file:

No Docker or Something

Please use the preview pane to ensure it looks nice.

d. My complete Caddy config:

First Steps install Guide. Its a Basic Config.

Thank you very much! Your help will help me a lot!

Caddy itself doesn’t handle uploads. If you need to upload files, you need to write an app in your favourite serverside programming language that will handle it. Then you can put Caddy in front of it (with reverse_proxy) to enable HTTPS.

Or you could use this plugin GitHub - git001/caddyv2-upload: This repo holds a simple caddyserver v2 upload handler

Thank you very much.
This raises the question about your link. If I understand it correctly, this helps when uploading files. Does it then not matter where the target folder is?

Even if Caddy can’t do that. What about a detailed log?
What I mean is: The external service sends the HTTP request. My Caddy records the HTTP request and writes the HTTP request to me in a detailed log in which it says what documents are sent, how big the documents are, where the request comes from and where the request then goes?

Add the log directive to your config to enable access logs: log (Caddyfile directive) — Caddy Documentation. It won’t have information about the files though because that requires actually reading the request body (which is a stream) and Caddy itself has nothing that parses file uploads itself. You need to reverse_proxy it to an application that does or use a plugin like the one I linked above.

I can’t help with the plugin, because it’s unofficial and I don’t use it myself. You can ask for help with the plugin by opening an issue on its repo.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.