Skip to content
This repository has been archived by the owner on Jan 30, 2019. It is now read-only.

Striping last slash can cause INFINITE redirect loop #18

Open
alfredxiao opened this issue Dec 6, 2015 · 2 comments
Open

Striping last slash can cause INFINITE redirect loop #18

alfredxiao opened this issue Dec 6, 2015 · 2 comments

Comments

@alfredxiao
Copy link

(str (assoc (cemerick.url/url "http://abc.com:80/haha/") :port 8080))
=> "http://abc.com:8080/haha"
where you can see the ending slash is striped off.

I am using this url library in a reverse proxy. The reverse proxy would replace the "Location" header returned by a web server with its own hostname/port. This means last slash character is stripped off. Imagine below interactions

  1. browser request http://www.simpleweb.org/ietf/mibs/modules/html
  2. reverse proxy forward it to web server
  3. web server returns 301, Location: http://www.simpleweb.org/ietf/mibs/modules/html/
  4. reverse proxy replace it with its own hostname/port, using url library and new url is: http://reverseproxy_host:8080/ietf/mibs/modules/html
  5. browser request http://reverseproxy_host:8080/ietf/mibs/modules/html
  6. reverse proxy forward it to web server
  7. web server sees it not ending with '/', returns 301 again
  8. repeats
    ...
@Eschon
Copy link

Eschon commented May 23, 2016

👍
I don't have problems with infinite redirects but stripping the last slash from an url that I use somehow makes it so that HTTPS doesn't work.

@agriffis
Copy link

dup of #9

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants