[ 
https://issues.apache.org/jira/browse/TS-3523?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sudheer Vinukonda updated TS-3523:
----------------------------------
    Description: 
{{proxy.config.reverse_proxy.enabled}} enables the remapping functionality, 
but, with {{proxy.config.url_remap.remap_required}} turned off, ATS should 
simply proxy the request over when no remap rule matches the incoming request 
url. However, the current implementation of ATS returns a 404. Note the request 
works fine if sent using explicit proxy mode (e.g. curl -x).

The issue is that, the url component in the HttpHdr is not created/populated 
when the remap logic can't find any valid mapping for the incoming request url. 

The below patch fixes the problem.

{code}
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index c586f0a..7cd749b 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -894,6 +894,10 @@ 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()) {
+      s->hdr_info.client_request.set_url_target_from_host_field();
+    }
+
     /////////////////////////////////////////////////////////
     // check for: (1) reverse proxy is on, and no URL host //
     /////////////////////////////////////////////////////////
{code}

  was:
{{proxy.config.reverse_proxy.enabled}} enables the remapping functionality, 
but, with {{proxy.config.url_remap.remap_required}} turned off, ATS should 
simply proxy the request over. However, the current implementation of ATS 
returns a 404. Note the request works fine if sent using explicit proxy mode 
(e.g. curl -x).

The issue is that, the url component in the HttpHdr is not created/populated 
when the remap logic can't find any valid mapping for the incoming request url. 

The below patch fixes the problem.

{code}
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index c586f0a..7cd749b 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -894,6 +894,10 @@ 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()) {
+      s->hdr_info.client_request.set_url_target_from_host_field();
+    }
+
     /////////////////////////////////////////////////////////
     // check for: (1) reverse proxy is on, and no URL host //
     /////////////////////////////////////////////////////////
{code}


> ATS returns 404 with proxy.config.reverse_proxy.enabled with no remap rules 
> even when proxy.config.url_remap.remap_required is disabled
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TS-3523
>                 URL: https://issues.apache.org/jira/browse/TS-3523
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: HTTP
>            Reporter: Sudheer Vinukonda
>             Fix For: 6.0.0
>
>
> {{proxy.config.reverse_proxy.enabled}} enables the remapping functionality, 
> but, with {{proxy.config.url_remap.remap_required}} turned off, ATS should 
> simply proxy the request over when no remap rule matches the incoming request 
> url. However, the current implementation of ATS returns a 404. Note the 
> request works fine if sent using explicit proxy mode (e.g. curl -x).
> The issue is that, the url component in the HttpHdr is not created/populated 
> when the remap logic can't find any valid mapping for the incoming request 
> url. 
> The below patch fixes the problem.
> {code}
> diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
> index c586f0a..7cd749b 100644
> --- a/proxy/http/HttpTransact.cc
> +++ b/proxy/http/HttpTransact.cc
> @@ -894,6 +894,10 @@ 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()) {
> +      s->hdr_info.client_request.set_url_target_from_host_field();
> +    }
> +
>      /////////////////////////////////////////////////////////
>      // check for: (1) reverse proxy is on, and no URL host //
>      /////////////////////////////////////////////////////////
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to