logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Apache mod_proxy/mod_rewrite geoip header issue
Author
jfountain



Joined: 27 May 2016
Posts: 2
Location: US, New Hope

PostPosted: Fri 27 May '16 22:44    Post subject: Apache mod_proxy/mod_rewrite geoip header issue Reply with quote

up vote
0
down vote
favorite
I need to proxy pass a request from www.server.com to home.server.com to set a cookie. The home.server.com sets the geo location of the user. However, when the request is passed from www.server.com to home.server.com, the geoip_* environment settings are either being dropped/stripped or ignored.

If I go directly to home.server.com, I see it setting correctly. It is not setting (empty) when I start from www.server.com.

<code>
RewriteCond %{HTTP_COOKIE} !SESSIONID=
RewriteCond %{REQUEST_URI} !^/[a-z]
RewriteCond %{QUERY_STRING} !^[a-z]
RewriteRule ^(.*)$ http://home.server.com [P,L]
</code>
Thank you for any advice/input! What am I missing?
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Fri 27 May '16 23:25    Post subject: Reply with quote

Sounds like geoip is on the frontend but it's an environment variable local to the frontend so it's not going to be passed along unless you pass it along to the backend in either a header or in the URI.

If mod_geoip were on the backend and using mod_remoteip, the real ip would be available to the backend and it can figure out the geolocation.
Back to top
jfountain



Joined: 27 May 2016
Posts: 2
Location: US, New Hope

PostPosted: Sat 28 May '16 0:09    Post subject: Reply with quote

Thanks for the reply.

I tried setting it because I thought that may be it.

Maybe I am setting it wrong?

RequestHeader set GEOIP_POSTAL_CODE "%{GEOIP_POSTAL_CODE}e"
or is it
RequestHeader add GEOIP_POSTAL_CODE "%{GEOIP_POSTAL_CODE}e"

I have tried both.
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Sat 28 May '16 3:17    Post subject: Reply with quote

That's bizarre and not completely compliant with the RFC which clearly states the field-name is a token, a token can consist of one or more tchar and a tchar includes among other things, an underscore!

Loose the underscores in the header name like

RequestHeader set GEOIP-POSTAL-CODE "%{GEOIP_POSTAL_CODE}e"
or
RequestHeader set GEOIPPOSTALCODE "%{GEOIP_POSTAL_CODE}e"

and try it, you'll have to adjust what sets the cookie on the backend.
Back to top


Reply to topic   Topic: Apache mod_proxy/mod_rewrite geoip header issue View previous topic :: View next topic
Post new topic   Forum Index -> Apache