Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caddy v2 header replacement causes websockets to stop working. #407

Closed
lue30499 opened this issue Aug 4, 2022 · 7 comments
Closed

Caddy v2 header replacement causes websockets to stop working. #407

lue30499 opened this issue Aug 4, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@lue30499
Copy link

lue30499 commented Aug 4, 2022

Describe the bug
Caddy v2 header replacement causes websockets to stop working.
Is there a way that search pattern or replacement part can not wipeout the websocket headers?

Theme Install Method (Don't skip)

Application Info

  • Version caddy 2.5.2

This doesn't allow websockets to work in caddy v2

....
        @sonarr host sonarr.domain.tld
        handle @sonarr {
                authorize with default_policy
                filter {
                        content_type text/html.*
                        search_pattern </head>
                        replacement "<link rel='stylesheet' type='text/css' href='https://theme-park.dev/css/base/sonarr/plex.css'></head>"
                }
                reverse_proxy http://srv-l-01.internal.domain:8989 {
                        header_up -Accept-Encoding
                }
        }
....

But this does allow websockets to work in caddy v2

....
        @sonarr host sonarr.domain.tld
        handle @sonarr {
                authorize with default_policy
#                filter {
#                        content_type text/html.*
#                        search_pattern </head>
#                        replacement "<link rel='stylesheet' type='text/css' href='https://theme-park.dev/css/base/sonarr/plex.css'></head>"
#                }
                reverse_proxy http://srv-l-01.internal.domain:8989 {
                        header_up -Accept-Encoding
                }
        }
....

Expected behavior
websockets to work

Screenshots
Screenshot from 2022-08-04 23-45-07

Desktop (If applicable) (please complete the following information):

  • OS: All
  • Browser: All

@lue30499 lue30499 added the bug Something isn't working label Aug 4, 2022
@GilbN
Copy link
Collaborator

GilbN commented Aug 13, 2022

@jef
Any tips?

@jef
Copy link

jef commented Aug 13, 2022

@GilbN I haven't ran into this yet. I can play around with it when I come from vacation.

@calmcacil
Copy link

This is a known issue with caddy2-filter, dont think you can really work around it, doesnt seem to be the case. Answered/explained by the plugin dev here sjtug/caddy2-filter#10, would be nice if we could find a solution to it though.

@GilbN
Copy link
Collaborator

GilbN commented Oct 8, 2022

This is a known issue with caddy2-filter, dont think you can really work around it, doesnt seem to be the case. Answered/explained by the plugin dev here sjtug/caddy2-filter#10, would be nice if we could find a solution to it though.

Thanks for the update.

Closing this based on the info above.

@GilbN GilbN closed this as completed Oct 8, 2022
@lue30499
Copy link
Author

lue30499 commented Oct 8, 2022

@GilbN
Not sure why you closed this when its not fixed.
I know caddy2-filter isn't your project but your documention says to use this plugin but it breaks basic functionality of WS.

Is there another plugin?
Is there another way to do this with caddy?

Regards,
Lue.

@GilbN
Copy link
Collaborator

GilbN commented Oct 8, 2022

@GilbN Not sure why you closed this when its not fixed. I know caddy2-filter isn't your project but your documention says to use this plugin but it breaks basic functionality of WS.

Is there another plugin? Is there another way to do this with caddy?

Regards, Lue.

Switch to nginx. Caddy doesn't support subfiltering with websockets. What do you want me to do about it.

@lue30499
Copy link
Author

lue30499 commented Oct 8, 2022

@GilbN
"Switch to nginx."
Ok I will probably do that.

"What do you want me to do about it."
Probably remove caddy from the docs as a support proxy for sonarr, radarr and anything that uses WS.

Made me believe it would work without issue...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants