Solved

Apache Set Response Header if nonexistent

Posted on 2011-02-25
3
580 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Node.js 11 82
Why isn't my DIV and Form centering? 1 31
How to hide contact form only if no validation errors 4 65
Which is best Image Resizing Web service 11 42
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

752 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