Help me about Filter problem, thanks

Hey guys, I can’t verify after using the filter on my website, directly prompting 401 Unauthorizd, no dialog box. And I don’t want to delete the verification, thank you.

https://www.*****.com {
root /usr/local/caddy/www
tls xxx@xxxxx.com
basicauth / 123 456
timeouts none
gzip
filter rule {
content_type text/.*
search_pattern xxxxx/images/
replacement xxxxx/gooimg/
}
}

Hi @ps2xu, welcome to the Caddy community.

What version of Caddy are you using?

Can you give us the output of: curl -kIL https://www.*****.com

Can you then remove the filter directive and give us the output of the same command?

Hey, thank you for your help.
-------------------with filter---------------------
HTTP/1.1 401 Unauthorized
Content-Type: text/plain; charset=utf-8
Server: Caddy
X-Content-Type-Options: nosniff
Date: Thu, 27 Jun 2019 00:43:54 GMT
Content-Length: 17
with%20filter
-------------------------After remove the filter--------------------
HTTP/1.1 401 Unauthorized
Content-Type: text/plain; charset=utf-8
Server: Caddy
Www-Authenticate: Basic realm=“Restricted”
X-Content-Type-Options: nosniff
Date: Thu, 27 Jun 2019 01:21:20 GMT
Content-Length: 17

I just tested this with Caddy (v1.0.0 (h1:KI6RPGih2GFzWRPG8s9clKK28Ns4ZlVMKR/v7mxq6+c=)). This part goes missing when the filter directive is added, I’m not quite sure why. basicauth should execute after filter in plugin order, and this header should be added by basicauth.

Could you please add a new issue here: Issues · caddyserver/caddy · GitHub

Fill out the issue template and include a link to this thread. It might be that the issue is with filter, in which case an issue will have to be opened at GitHub - echocat/caddy-filter: Provides a directive to filter response bodies in caddy. instead, but we’ll figure that out.

Thank you very much, I have opened an issue.

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