0

We are trying to read specific character out of http request header to determine the type of URL it needs to be forwarded it.

E.g., Http header - HTTP_ACCEPT=version.ver1+xml

In Httpd.config, we need requested version value (as in above case its - ver1) before forwarding to specific version URL like, http://server:port/application_<ver1>.

Is there any way to configure through http modules like rewrite or setenvif etc..

1
  • Sujit. Did this answer help? Thanks Feb 12, 2016 at 21:41

1 Answer 1

0

You should be able to accomplish this with a Rewrite. For example:

RewriteEngine On
RewriteCond %{HTTP:Accept} version\.(ver1)\+xml [NC]
RewriteRule ^(.*) http://server:port/application_%1 [L]

Of course this may need to be altered depending on your requirements.. e.g. if you needed to carry over anything about the original request like the hostname or URI. Then you may need to use variables and back-references for those. For example:

RewriteRule ^(.*) http://%{HTTP_HOST}/application_%1$1 [L]

Rewrites also require mod_rewrite to be enabled in the main config:

LoadModule rewrite_module modules/mod_rewrite.so

The following links provide more info on those directives:

http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.