Arc Forumnew | comments | leaders | submitlogin
1 point by shader 5712 days ago | link | parent

Well, right now it looks like the srv.arc code already checks for an X-Forwarded-For header. The applicable code is:

  (let proxy-header "X-Forwarded-For: "
    (def strip-header(s)
      (subst "" proxy-header s))
    (def proxy-ip(ip-wrapper lines)
      (aif (only.strip-header (car:keep [headmatch proxy-header _] lines))
          (ip-wrapper it)
          (ip-wrapper))))
This defines a proxy-ip function, which is later used to determine whether an ip is abusive or not, by returning the ip either given by sock-accept, or the X-Forwarded-For header.

It seems to me that the easiest way to support X-Real-Ip would be (presuming it's an http header) to let proxy-header be "X-Real-Ip" instead of "X-Forwarded-For". Alternatively, you could expand the functions to be able to take a list of header strings instead of just one.



2 points by akkartik 5712 days ago | link

Yeah I made that change in anarki; it's not in vanilla arc. http://arclanguage.org/item?id=11199

-----

1 point by kschwen 5712 days ago | link

Awesome! I switched to your version of Arc. Judging by that diff, I'm happy you already fixed it ;).

-----