Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6542421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:13:32+00:00 2026-05-25T11:13:32+00:00

I would like to forward a request in Apache, based on a request header,

  • 0

I would like to forward a request in Apache, based on a request header, to a different forward proxy. I think the best would be to use mod_rewrite, but it can use only a reverse proxy defined in the same apache configuration.

I also checked the ProxyRemote property of mod_proxy but it can’t be used based on conditions, only based on request url’s.

I need something like:

If X-CUSTOM-HEADER is value-1 -> forward request to forward proxy p1
If X-CUSTOM-HEADER is value-2 -> forward request to forward proxy p2

etc.

Din anyone managed to make something like this?

Thanks,
Alin

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:13:33+00:00Added an answer on May 25, 2026 at 11:13 am

    I found a solution, its not really elegant. It involves some adaptation on the second server as well.

    It derives from a project where I had a similar problem, but needed the servers to be “fully” (selected by a custom script that uses database resources).

    This should at least work (I run my URL through a rewrite map to modify it, I adapted it to use headers using RewriteCond).

    # example for server number "5" in your remote proxy network
    RewriteCond %{HTTP:X-CUSTOM-HEADER} 1
    RewriteRule http://([a-z0-9\.]+)/(.*) http://$1.5.server.yourdomain.com$1 [P] 
    ProxyRemoteMatch .*\.5\.server\.yourdomain\.com.* http://5.server.yourdomain.com:80
    

    You basically adapt the URL so it is a subdomain of your second server, then you strip it out again.
    This part goes on the second (remote proxy server):

    <ProxyMatch "http://.*\.[0-9]+\.server\.yourdomain\.com/.*">
        RewriteEngine on
        RewriteRule (proxy:http[s]?://.+)\.[0-9]+\.server\.premiumize\.me(.+) $1$2 
        ... your code ...
    </ProxyMatch>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I receive a POST request at my PHP script and would like to forward
I would like to forward iphone users to a mobile version of my site
Would like to be able to set colors of headings and such, different font
I would like to try to use OpenSocial (or any other API) for my
Can someone please tell me why this isn't working? I would like to be
I have configured my apache 2.2 server as a simple forward proxy using mod_proxy
I would like someone to explain me what _forward is exactly doing, I cannot
Would like to get a list of advantages and disadvantages of using Stored Procedures.
Would like to create a strong password in C++. Any suggestions? I assume it
Would like to know what a programmer should know to become a good at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.