Discussion:
remap.config trailing slash problem
Sean G
2018-07-18 07:24:53 UTC
Permalink
Hi Everyone,First time question, so please take it easy with me :)I'm using
ATS to act as a basic forwarding proxy to a known end-point. Everything is
working exactly as I want it to apart from one minor issue. *Works fine
example*----------------------Call target URL (e.g. http://www.abc.com/c/)
and replacement content (http://www.xyz.com/c/) is called and shown.i.e.
http://www.abc.com/c/ remains in the browser*Issue example *(notice the
missing end slash on the target url!)----------------Call target URL (e.g.
http://www.abc.com/c) but replacement (http://www.xyz.com/c/) is shown as as
browser URL like its doing a redirect?i.e. http://www.xyz.com/c/ is shown in
bowser instead of http://www.abc.com/c This seems to be all because of a
missing end slash.records.config has all default settings apart from
server_ports STRING r-pass:80 and proxy.config.http.cache.http 0 (I dont
wish to cache).remap.config has the following...map http://www.abc.com/
http://www.xyz.com/I tried reverse_mapand redirect but with no success. Can
someone point me in the right direction please?Many thanks in advance.



--
Sent from: http://apache-traffic-server.24303.n7.nabble.com/
Miles Libbey
2018-07-19 05:09:59 UTC
Permalink
Hi-

Could you show the results of a cURL both through your ATS and direct
to the origin? eg

through your ATS -- change 192.168.0.1 to its IP, and port 80 to its http port
$ curl -IX GET -x 192.168.0.1:80 http://www.abc.com/c
...

and to the origin:
$ curl -IX GET http://www.abc.com/c

miles
Hi Everyone, First time question, so please take it easy with me :) I'm
using ATS to act as a basic forwarding proxy to a known end-point.
Everything is working exactly as I want it to apart from one minor issue.
Works fine example ---------------------- Call target URL (e.g.
http://www.abc.com/c/) and replacement content (http://www.xyz.com/c/) is
called and shown. i.e. http://www.abc.com/c/ remains in the browser Issue
example (notice the missing end slash on the target url!) ----------------
Call target URL (e.g. http://www.abc.com/c) but replacement
(http://www.xyz.com/c/) is shown as as browser URL like its doing a
redirect? i.e. http://www.xyz.com/c/ is shown in bowser instead of
http://www.abc.com/c This seems to be all because of a missing end slash.
records.config has all default settings apart from server_ports STRING
r-pass:80 and proxy.config.http.cache.http 0 (I dont wish to cache).
remap.config has the following... map http://www.abc.com/
http://www.xyz.com/ I tried reverse_mapand redirect but with no success. Can
someone point me in the right direction please? Many thanks in advance.
________________________________
Sent from the Apache Traffic Server mailing list archive at Nabble.com.
Sean G
2018-07-19 11:53:59 UTC
Permalink
Hi,

Many thanks for the reply. Outputs below... (ive also included a CURL direct
to origin, www.xyz.com which seems to be a 301 as well. Could this be
confusing things?).

A little more info, I tried on my works network and the target
(www.abc.com/c) remains (as expected, www.abc.com/c/) using chrome browser
but when trying on my phone or home network, the origin (www.xzy/c/) is
shown instead (chrome browser as well). Its like we have different calling
systems either following the 301 or ignoring the 301?

*------
$ curl -IX GET -x 127.0.0.1:80 http://www.abc.com/c

HTTP/1.1 301 Moved Permanently
Server: ATS/7.1.3
Date: Thu, 19 Jul 2018 11:22:23 GMT
Content-Type: text/html
Content-Length: 178
Location: http://www.abc.com/c/
Age: 0
Proxy-connection: keep-alive

*------

$ curl -IX GET http://www.abc.com/c

HTTP/1.1 301 Moved Permanently
Server: ATS/7.1.3
Date: Thu, 19 Jul 2018 11:25:42 GMT
Content-Type: text/html
Content-Length: 178
Location: http://www.abc.com/c/
Age: 0
Proxy-connection: keep-alive

*------

$ curl -IX GET http://www.xyz.com/c

HTTP/1.1 301 Moved Permanently
Server: ATS/7.1.3
Date: Thu, 19 Jul 2018 11:32:16 GMT
Content-Type: text/html
Content-Length: 178
Location: http://www.xyz.com/c/
Age: 0
Proxy-connection: keep-alive

Many thanks



--
Sent from: http://apache-traffic-server.24303.n7.nabble.com/
Sean G
2018-07-19 12:50:25 UTC
Permalink
UPDATE

I've added the following config (new lines, as they were not present) to
records.config

proxy.config.http.redirection_enabled INT 1

proxy.config.http.number_of_redirections INT 1

www.abc.com/c now correctly shows to 301 redirect as www.abc.com/c/

I then tried testing with the IP address of www.abc.com (1.2.3.4/c/) but
this incorrectly shows the IP of the origin/c/ (9.8.7.6/c/).

Do you know if I need to change or add some type of DNS or IP setting with
redirects?

Many thanks in advance.



--
Sent from: http://apache-traffic-server.24303.n7.nabble.com/
Miles Libbey
2018-07-19 21:04:27 UTC
Permalink
A few things strike me:
- the proxy.config.http.redirection_enabled ==1 will have ATS chase
the redirect. Eg, when the origin is returning the 301 for c to c/,
ATS would go fetch c/ and return the results of c/ to the user. I
think this would explain what your original post was showing? eg, when
going ATS the browser address bar had c, but, the body of c/.
- In all of your curls, the header "Server: ATS/7.1.3" was present
... which makes me think that you were always going to your ATS
instead of your origin directly.
Post by Sean G
UPDATE
I've added the following config (new lines, as they were not present) to
records.config
proxy.config.http.redirection_enabled INT 1
proxy.config.http.number_of_redirections INT 1
www.abc.com/c now correctly shows to 301 redirect as www.abc.com/c/
I then tried testing with the IP address of www.abc.com (1.2.3.4/c/) but
this incorrectly shows the IP of the origin/c/ (9.8.7.6/c/).
Do you know if I need to change or add some type of DNS or IP setting with
redirects?
Many thanks in advance.
--
Sent from: http://apache-traffic-server.24303.n7.nabble.com/
Sean G
2018-07-20 13:18:01 UTC
Permalink
Yeah, I need to manually type the outputs from my phone as I was unable to
run them at work (clunky!!). The last response as nginx and you pointed me
in the right direction, so many thanks for that.

For anyone else having issues like this, the following settings are key (for
me anyway)

records.config

CONFIG proxy.config.url_remap.remap_required INT 1
CONFIG proxy.config.url_remap.pristine_host_hdr INT 1
CONFIG proxy.config.reverse_proxy.enabled INT 1
CONFIG proxy.config.http.redirection_enabled INT 1
CONFIG proxy.config.http.number_of_redirections INT 0

Thanks again, you really helped me out.



--
Sent from: http://apache-traffic-server.24303.n7.nabble.com/

Loading...