Summary: | mod_rewrite unable to proxy websocket URIs | ||
---|---|---|---|
Product: | Apache httpd-2 | Reporter: | Chris Harris <chris.harris> |
Component: | mod_rewrite | Assignee: | Apache HTTPD Bugs Mailing List <bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | chris.harris |
Priority: | P2 | Keywords: | PatchAvailable |
Version: | 2.5-HEAD | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Linux | ||
Attachments: | Patch to add websocket protocols to is_absolute_uri(...) |
Committed revision 1528556 in trunk. Will propose for 2.4 backport Getting this backported to 2.4 would be great. Hey there, is it realistic to expect backport on 2.2 httpd-2.2.15-47.el6.centos.3.x86_64 I have tested your patch and it works perfectly. Thank you very much. I just wonder if custom or official mod_rewrite.so can be approved. Not sure what the process for backport to 2.2 is, but it seem unlikely I think. (In reply to Chris Harris from comment #4) > Not sure what the process for backport to 2.2 is, but it seem unlikely I > think. Ok, thank you, Just wonder, will this broke current mod_rewrite in any case? case 'w': case 'W': if (!strncasecmp(uri, "s://", 4)) { /* ws:// */ return 5; } else if (!strncasecmp(uri, "ss://", 5)) { /* wss:// */ return 6; } break; } I suppose not and want to build mod_rewrite.rpm just for that needs. (proxy-ing websockets dynamically ) # simply and easy rule like would work ( i checked it, and any variations ) RewriteRule ^websockify/([^/]+)/([^/]+) wss://$1:$2/websockify [P] |
Created attachment 30886 [details] Patch to add websocket protocols to is_absolute_uri(...) Given the following rewrite rule: RewriteRule ^/ws(.*)$ ws://localhost:9000/ws [P] mod_rewrite treats this a filepath so the access log shows: [26/Sep/2013:09:46:07 -0400] "GET /ws://localhost:9000/ws HTTP/1.1" 400 317 This problem is that is_absolute_uri(...) is returning 0 for URIs starting with ws:// or wss://. I have attached a patch against HEAD that add a case to is_absolute_uri(...) to match the websocket protocols. This allow websocket traffic to be proxied using mod_rewrite.