GitHub user ykopel opened an issue:

    https://github.com/apache/trafficserver/issues/1448

    Avoid forcing "proxied URL" in case of transparent request

    In the proxy/http/HttpTransact.cc file there is a call to 
"set_url_target_from_host_field" on each request that doesn't contain the 
"target" hostname in its URL part.
    This means that in transparent mode the client can send a request with 
"partial" URL like this:
    ```
    GET /partial HTTP/1.1
    Host: 192.168.0.100:8000
    Accept-Encoding: identit
    ```
    But the trafficserver will add the hostname even if its in transparent 
mode. Like this:
    ```
    GET http://192.168.0.100:8000/partial HTTP/1.1
    Host: 192.168.0.100:8000
    Accept-Encoding: identit
    ```
    
    I think It will be good to add to the code the check of the transparent 
status before deciding to add the hostname to the URL part.
    
    Here is a diff for the HttpTransact.cc file:
    ```
    diff --git a/trafficserver/proxy/http/HttpTransact.cc b/HttpTransact.cc
    index 085ebb5..1d143c3 100644
    --- a/trafficserver/proxy/http/HttpTransact.cc
    +++ b/HttpTransact.cc
    @@ -820,7 +820,7 @@ HttpTransact::EndRemapRequest(State *s)
           TRANSACT_RETURN(SM_ACTION_INTERNAL_CACHE_NOOP, NULL);
         }
     
    -    if (!s->http_config_param->url_remap_required && 
!incoming_request->is_target_in_url()) {
    +    if (!s->http_config_param->url_remap_required && 
!incoming_request->is_target_in_url() && !s->client_info.is_transparent) {
           s->hdr_info.client_request.set_url_target_from_host_field();
         }
     
    @@ -7785,7 +7785,9 @@ HttpTransact::build_request(State *s, HTTPHdr 
*base_request, HTTPHdr *outgoing_r
         }
       }
     
    -  if (s->current.server == &s->server_info && (s->next_hop_scheme == 
URL_WKSIDX_HTTP || s->next_hop_scheme == URL_WKSIDX_HTTPS ||
    +  // If the connection is transparent and the target is in the URL - keep 
it there
    +  if (s->current.server == &s->server_info && 
!(s->client_info.is_transparent && base_request->is_target_in_url()) &&
    +                                              (s->next_hop_scheme == 
URL_WKSIDX_HTTP || s->next_hop_scheme == URL_WKSIDX_HTTPS ||
                                                    s->next_hop_scheme == 
URL_WKSIDX_WS || s->next_hop_scheme == URL_WKSIDX_WSS)) {
         DebugTxn("http_trans", "[build_request] removing host name from url");
         HttpTransactHeaders::remove_host_name_from_url(outgoing_request);
    ```

----

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to