plugin-rewritebody icon indicating copy to clipboard operation
plugin-rewritebody copied to clipboard

"request method or response status code does not allow body"

Open ptruman opened this issue 4 years ago • 1 comments

Hi

I'm trying to rewrite a FreePBX admin page within my Docker container. I've setup a local CNAME for the container, and use the "addprefix" middleware to add "/admin" to the URL, so that that CNAME always drops to the admin site.

The CDR (call logs) page however, has hardcoded the prefix "/admin/config.php" into it's response, which causes Traefik to fail (/admin/admin doesn't exist). I've tried a combination of regexredirects which don't seem to work, so I'm now trying this plugin

I'm using labels, and have the following ones setup (via Portainer)

traefik.http.middlewares.mw_cdr.plugin.rewritebody.rewrites[0].regex="/admin/config.php"
traefik.http.middlewares.mw_cdr.plugin.rewritebody.rewrites[0].replacement="/config.php"

My traefik toml contains:

[experimental.plugins]
        [experimental.plugins.rewritebody]
                modulename = "github.com/traefik/plugin-rewritebody"
                version = "v0.3.1"

I'm getting the following in my traefik logs

2021/01/01 14:56:12 unable to write rewrited body: http: request method or response status code does not allow body,
2021/01/01 14:56:02 unable to write rewrited body: http: request method or response status code does not allow body,
plugins-storage/sources/gop-608393850/src/github.com/traefik/plugin-rewritebody/rewritebody.go:93:3: panic

ptruman avatar Jan 01 '21 15:01 ptruman

have something similar but its working with wget getting url and not working with browser. I'm a bit frustrated on this :-/

lazyest avatar Aug 10 '21 19:08 lazyest