Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8906C200BEB for ; Wed, 28 Dec 2016 08:15:32 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 87879160B2E; Wed, 28 Dec 2016 07:15:32 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D023B160B19 for ; Wed, 28 Dec 2016 08:15:31 +0100 (CET) Received: (qmail 59204 invoked by uid 500); 28 Dec 2016 07:15:30 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 59190 invoked by uid 99); 28 Dec 2016 07:15:30 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Dec 2016 07:15:30 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 007C5C0C1F for ; Wed, 28 Dec 2016 07:15:30 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.1 X-Spam-Level: X-Spam-Status: No, score=-3.1 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RP_MATCHES_RCVD=-2.999, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=domblogger.net Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 7s_toEHlYsd3 for ; Wed, 28 Dec 2016 07:15:29 +0000 (UTC) Received: from mail.domblogger.net (mail.domblogger.net [104.200.18.67]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id E18E05F24B for ; Wed, 28 Dec 2016 07:15:28 +0000 (UTC) Received: from localhost.localdomain (c-50-184-37-123.hsd1.ca.comcast.net [50.184.37.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.domblogger.net (Postfix) with ESMTPSA id 1C6C3121D for ; Wed, 28 Dec 2016 07:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=domblogger.net; s=default; t=1482909322; bh=D2lTQAmvuofvjBSaoGlgLcAPGZmtacAzDTKvkw6vGFk=; h=Subject:To:References:From:Date:In-Reply-To; b=Ol6kYCgwXKdRaJo+EzPg/6btVuCBHEvPqZ9ndkv/38g51ucjspdrDUcc4zUwFlGy8 OMmWz1w2r05u7tBjNFsWWhr4eWb7Y4UPARaD+0unt3reBQMk2ZvY2zTj11imf5Zz4c 7ixFBE+WOt7jPq3/8DAUUbJBmCsPtG277M29HAUU= To: users@httpd.apache.org References: <4baea575-279f-f032-cf2e-de7564404f50@domblogger.net> From: "Michael A. Peters" Message-ID: Date: Tue, 27 Dec 2016 23:15:21 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <4baea575-279f-f032-cf2e-de7564404f50@domblogger.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [users@httpd] Why ExpiresByType is ignored when has SetHandler application/x-httpd-php ? archived-at: Wed, 28 Dec 2016 07:15:32 -0000 Oh I should add - when it is a php file I also set the cache control via php. header('Cache-Control: max-age=' . $maxage); for example. On 12/27/2016 11:12 PM, Michael A. Peters wrote: > Hi, I regularly use php to generate all kinds of different XML. > > This is what I do - > > header('Content-Type: application/xml'); > print($dom->saveXML()); > exit(); > > Of course in that case $dom is a DOMDocument object - if you are using > print or echo to create XML then you need the header at the beginning of > the php, as it needs to be before any content is sent. > > Using php to send the header avoids the need to set it with Apache. > > > On 12/27/2016 10:58 PM, Binyamin wrote: >> בע"ה >> >> Hi, >> >> As I wrote in earlier example, `Header set Content-Type >> "application/xml"` still returns 1 day expiration (not the one defined >> in ExpiresByType). >> The same result when switching configuration order of FilesMatch >> before ExpiresDefault, or order of LoadModule's expires_module and >> headers_module. >> >> Also this example will return expiration only 1 day, while expected 1 >> year: >> >> >> Header set Content-Type "application/xml" >> ExpiresDefault "access plus 1 year" >> >> >> it returns >> >> Content-Type: application/xml >> Date: Wed, 28 Dec 2016 06:38:09 GMT >> Expires: Thu, 29 Dec 2016 06:38:09 GMT >> >> >> It seems to as a Apache bug. I don't know if ever it was working. >> >> Any workaround (configuration fix) for it for now? >> Do you know if it worked right in any Apache build/version? >> >> >> Binyamin >> >> >> On Wed, Dec 28, 2016 at 5:29 AM, Yehuda Katz > > wrote: >> >> It might have something to do with the order the modules handle the >> request. >> What happens if you tell PHP to set the content type to >> application/xml? >> >> - Y >> >> On Tue, Dec 27, 2016 at 3:55 PM, Binyamin <7raivis@inbox.lv >> > wrote: >> >> בע"ה >> >> >> Why ExpiresByType is ignored when has SetHandler >> application/x-httpd-php ? >> >> /sitemap.xml Response Headers shows 1 day expiration while >> expected to be 1 year (1 month) >> >> Content-Type: application/xml; charset=utf-8 >> Date: Tue, 27 Dec 2016 19:59:00 GMT >> Expires: Wed, 28 Dec 2016 19:59:00 GMT >> >> seems SetHandler forces it to apply text/html expiration and >> doesn't allow to rewrite it >> >> ExpiresActive On >> ExpiresDefault "access plus 1 month" >> ExpiresByType text/html "access plus 1 day" >> ExpiresByType application/xml "access plus 1 week" >> >> >> SetHandler application/x-httpd-php >> Header set Content-Type "application/xml" >> ExpiresDefault "access plus 1 year" >> >> >> tested on Apache 2.4.X builds. >> >> How to fix this issue? >> >> >> >> Binyamin >> >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org > For additional commands, e-mail: users-help@httpd.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org For additional commands, e-mail: users-help@httpd.apache.org