• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

191
Views
http request forwarding according to the http header in apache

I have an apache server that gets http requests with 3 different headers. Depending on the header, I have to send it to backend servers.

Url : abc.com/check

Headers :

"Content-Type: app1"

"Content-Type: app2"

"Content-Type: app3"

Depending on the above header , the request has to be sent to backend app servers .

server1 : http://server1/s1 if "Content-Type: app1"

server2 : http://server1/s2 if "Content-Type: app2"

server3 : http://server1/s3 if "Content-Type: app3"

Please help me out .

Thanks.

about 3 years ago · Santiago Trujillo
1 answers
Answer question

0

I figured it out .Below snippet works our requirement. Some enhancements I'm thinking is to allow only POST requests .

<VirtualHost abc.com:80>
       ServerName abc.com

     RewriteEngine On
     RewriteCond %{HTTP:Content-Type} "app1"
     RewriteRule ^/check http://server1/s1 [P,L]

     RewriteCond %{HTTP:Content-Type} "app2"
     RewriteRule ^/check http://server1/s2 [P,L]

     RewriteCond %{HTTP:Content-Type} "app3"
     RewriteRule ^/check http://server1/s3 [P,L]

</VirtualHost>
about 3 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error