@@ -39,14 +39,17 @@ proxy_host({undefined, Req}, _Timeout) ->
39
39
ReplyReq ;
40
40
proxy_host ({Host , Req }, Timeout ) ->
41
41
{Method , Req } = cowboy_req :method (Req ),
42
- {Path , Req } = cowboy_req :path (Req ),
42
+ {HostUrl , Req } = cowboy_req :host_url (Req ),
43
+ {Url , Req } = cowboy_req :url (Req ),
44
+ UrlLen = byte_size (Url ),
45
+ PathUrl = binary :part (Url , {UrlLen , - (UrlLen - byte_size (HostUrl ))}),
43
46
{OrgHeaders , Req } = cowboy_req :headers (Req ),
44
47
NoHostHeaders = lists :keydelete (<<" host" >>, 1 , OrgHeaders ),
45
48
NoConnHeaders = lists :keydelete (<<" connection" >>, 1 , NoHostHeaders ),
46
49
{Cookies , CookiesReq } = cowboy_req :cookies (Req ),
47
50
BodyFun = {fun post_body /1 , self ()},
48
51
Resp = charreada_config :redirect_request (
49
- Method , Host , Path , NoConnHeaders , Cookies , BodyFun , Timeout ),
52
+ Method , Host , PathUrl , NoConnHeaders , Cookies , BodyFun , Timeout ),
50
53
handle_redirect (Resp , CookiesReq , Timeout ).
51
54
52
55
handle_redirect (ok , Req , Timeout ) ->
0 commit comments