You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by "andrew.ashcroft@holidaylettings.co.uk" <an...@holidaylettings.co.uk> on 2011/12/13 13:14:16 UTC

Issues with reverse proxy remapping absolute links

Hi,

I've just setup ATS as a reverse proxy and it's mostly working as expected but I can't figure out how to rewrite the URLs on the origin server.

For example, we have:

Internet --> ATSserver.com --> originserver.com

When visiting ATSserver.com, ATS is caching and the page from originserver.com is displaying as expected but as the links on originserver.com are absolute (e.g originserver.com/page2.html), when they are clicked, the browser goes to origingserver.com and not ATSserver.com.

Is there a way to get ATS to rewrite the base href so that all requests will go through the reverse proxy?

Remap.config has:

map             http://atsserver.com	http://originserver.com
reverse_map     http://originserver.com 	http://atsserver.com

Thanks in advance for any help,

Andrew

Re: connect_attempts_max_retries question

Posted by Leif Hedstrom <zw...@apache.org>.
On 1/6/12 7:47 AM, andrew.ashcroft@holidaylettings.co.uk wrote:
> Afternoon all,
>
>
> In records.config there is the setting
> proxy.config.http.connect_attempts_max_retries which defaults to 6. If a
> page has not returned in 2 mins then it is retried.
>
> We have a small number of long running scripts that are harmless but if
> run twice within 5 mins can cause events to be run multiple times. We are
> therefore considering setting retries to 0 as most users will have given
> in after 2 mins of inactivity on a normal page.

So, the server isn't sending anything at all back on the first request? I 
guess that will be treated as a connection failed attempt, and it will tear 
down that connection, and try again. Yes, setting it to 0 ought to have the 
effect you want, although, not sure it's ideal (what if a connection fails 
for a reason, and you really want it to make another connection attempt?).

Fwiw, note that this setting is also overridable per transaction. So, you 
could for example make a remap.config rule specifically for this one page 
you worry about, using the provides conf_remap.so plugin, and an appropriate 
config file (same format as records.config, but just put in that one config 
in there, setting it to 0). If you can do that, that's the best approach IMO.

Cheers,

-- leif

>
> Are there any issue with this config change?
>
> Many thanks,
>
>
> Andrew
>


connect_attempts_max_retries question

Posted by "andrew.ashcroft@holidaylettings.co.uk" <an...@holidaylettings.co.uk>.
Afternoon all,


In records.config there is the setting
proxy.config.http.connect_attempts_max_retries which defaults to 6. If a
page has not returned in 2 mins then it is retried.

We have a small number of long running scripts that are harmless but if
run twice within 5 mins can cause events to be run multiple times. We are
therefore considering setting retries to 0 as most users will have given
in after 2 mins of inactivity on a normal page.

Are there any issue with this config change?

Many thanks,


Andrew


Re: Issues with reverse proxy remapping absolute links

Posted by Leif Hedstrom <zw...@apache.org>.
On 12/13/11 5:14 AM, andrew.ashcroft@holidaylettings.co.uk wrote:
> Hi,
>
> I've just setup ATS as a reverse proxy and it's mostly working as expected but I can't figure out how to rewrite the URLs on the origin server.
>
> For example, we have:
>
> Internet -->  ATSserver.com -->  originserver.com
>
> When visiting ATSserver.com, ATS is caching and the page from originserver.com is displaying as expected but as the links on originserver.com are absolute (e.g originserver.com/page2.html), when they are clicked, the browser goes to origingserver.com and not ATSserver.com.
>
> Is there a way to get ATS to rewrite the base href so that all requests will go through the reverse proxy?
>
> Remap.config has:
>
> map             http://atsserver.com	http://originserver.com
> reverse_map     http://originserver.com 	http://atsserver.com
>
> Thanks in advance for any help,
>

Yeah, there is no such feature in ATS. Someone could write a transform 
plugin to do it. But honestly, you ought to fix the origin server ;). Make 
it either use relative links, or make use of "pristine host headers" 
(meaning, make originserver.com see and handle the Host: header with a value 
of atsserver.com).

-- Leif