V2: Rewrite GET as POST request? (continue)

I want to rewrite GET to POST request with the body request is GET request params.
Example:
GET
http://localhost:2015/get?query=%0A%20%20%20%20query%20chapters(%24comicSlug%3A%20String!)%20%7B%0A%20%20%20%20%20%20comics(limit%3A%201%2C%20where%3A%20%7B%20slug%3A%20%7B%20_eq%3A%20%24comicSlug%20%7D%7D)%20%7B%0A%20%20%20%20%20%20%20%20title%0A%20%20%20%20%20%20%20%20image%0A%20%20%20%20%20%20%20%20artists%0A%20%20%20%20%20%20%20%20authors%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20&variables=%7B%22comicSlug%22%3A%22dragon-ball%22%7D

to POST
http://localhost:8080/v1/graphql
with body is http.request.uri.query.query

From API documents, I don’t see any way to do this?

1. Caddy version (caddy version): 2.2.1

5. What I already tried:

`{
"logging": {
	"logs": {
		"debug": {
			"level": "DEBUG"
		}
	}
},
"apps": {
	"http": {
		"servers": {
			"example": {
				"listen": [":2015"],
				"routes": [
					{
						"handle": [
							{
								"handler": "rewrite",
								"method": "POST",
								"uri": "/v1/graphql?"
							},
							{
								"handler": "reverse_proxy",
								"upstreams": [
									{
									"dial": "localhost:8080"
									}
								]
							}
						]
					}
				]
			}
		}
	}
}

}`

6. Links to relevant resources:

the problem is exactly like this problem:

Hmm, yeah I don’t think the body of the request can be rewritten.

I think the best option for you is to write a Caddy plugin that does this:

Let us know if you need any help!

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