Solved

Apache Set Response Header if nonexistent

Posted on 2011-02-25
3
566 Views
Last Modified: 2012-05-11
Hi everybody,

how can I set a certain header in my response ONLY IF it doesn't exist?

More precisely, I want to set "Content-Encoding: identity" only in case that it doesn't exist already. If it does, it should keep its original value (e.g. "Content-Encoding: gzip")

Thanks in advance
Dani
0
Comment
Question by:kickeronline
3 Comments
 
LVL 8

Expert Comment

by:kivan24
ID: 34978612
Maybe:
if (strstr($_SERVER["HTTP_ACCEPT_ENCODING"],"identity")===0) {
    // set to et identity
} else {
    //keep its original value
}

Open in new window

0
 

Author Comment

by:kickeronline
ID: 34978634
Sorry, I'm searching more kind of a apache configuration for a vhost. I got to admit I could have chosen a better category :-/
0
 
LVL 48

Accepted Solution

by:
hernst42 earned 250 total points
ID: 34979969
Have you looked at http://httpd.apache.org/docs/2.2/en/mod/mod_headers.html Should be something like:

Header merge Content-Encoding identity
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question