Solved

Apache Set Response Header if nonexistent

Posted on 2011-02-25
3
533 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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 …

762 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now