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

Striping last slash can cause INFINITE redirect loop #18

@alfredxiao

Description

@alfredxiao

(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
    ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions