Additional http headers for images

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
JLA
Registered User
Posts: 500
Joined: Tue Nov 16, 2004 5:23 pm
Location: USA
Name: JLA FORUMS
Contact:

Additional http headers for images

Post by JLA » Tue Nov 05, 2019 4:11 pm

We serve some images from our attachment mod via a php file. In our code we designate custom http response headers.

So was wondering if we should specify the url of the post that the image appears in the response header with Content-Location or Location http response header? Is this normally done is there a better way?

Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 25454
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Additional http headers for images

Post by Paul » Tue Nov 05, 2019 5:50 pm

Is this for an extension /phpBB 3.2? If so, you will need an event that you can hook into.
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

User avatar
JLA
Registered User
Posts: 500
Joined: Tue Nov 16, 2004 5:23 pm
Location: USA
Name: JLA FORUMS
Contact:

Re: Additional http headers for images

Post by JLA » Tue Nov 05, 2019 5:57 pm

Paul wrote:
Tue Nov 05, 2019 5:50 pm
Is this for an extension /phpBB 3.2? If so, you will need an event that you can hook into.
No, just some private custom code that we wrote. In the code of the php file from which the image is served we currently have (for example on jpg files)

Code: Select all

header('Content-type: image/jpeg');
				header("Cache-Control: private, must-revalidate, max-age=5184000");
				header("Pragma: private");				
				header("Expires: " . gmdate('D, d M Y H:i:s', strtotime(" 60 day")).' GMT');
This php file is always called from the topic page but can also be called directly if it is hotlinked, etc. Just wondering if we should add a content-location or location header that specifies the topic or post url where the image originally appears.

Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 25454
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Additional http headers for images

Post by Paul » Tue Nov 05, 2019 6:46 pm

Well, this forum is for extensions / phpBB3.2 specific. We don't provide support for older versions or generic php questions unfortunately.
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

User avatar
JLA
Registered User
Posts: 500
Joined: Tue Nov 16, 2004 5:23 pm
Location: USA
Name: JLA FORUMS
Contact:

Re: Additional http headers for images

Post by JLA » Wed Nov 06, 2019 10:55 am

Paul wrote:
Tue Nov 05, 2019 6:46 pm
Well, this forum is for extensions / phpBB3.2 specific. We don't provide support for older versions or generic php questions unfortunately.
Understood – you can delete this post if you like I couldn’t find a way to do it here.

Post Reply

Return to “Extension Writers Discussion”