• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » Change CDN Object Metadata in HP Cloud CDN With cURL

By Abhishek Ghosh June 12, 2015 2:40 pm Updated on June 12, 2015

Change CDN Object Metadata in HP Cloud CDN With cURL

Advertisement

Possibly Most Important Parameter to Change is TTL or Expires. We Have Pointed How To Change CDN Object Metadata in HP Cloud CDN With cURL. We observed to get the data written as metadata but unfortunately we could not change the Expires or TTL. HP Cloud CDN means we are communicating with Akamai CDN Service via HP Cloud OpenStack Swift as HP Cloud’s Customer, it is not exactly easy to predict except being HP’s employee what values can be changes or has bug. There is zero visible effort from HP so far for setting setting the expire far ahead, so this might bring some help to the next person who might be able to write or change the expire or TTL. We are talking about object TTL or Expires. Container expire, TTL etc. should be set to higher.

 

Guide to Read Before Attempting To Change CDN Object Metadata in HP Cloud CDN

 

You should read this guide to authenticate in HP Cloud CDN. This is first step. Second step is learning about unix & epoch time stamp. Some of these values will need it instead of normal time in seconds. Searching the web with Epoch & Unix Timestamp Conversion Tools will give some easy to use tools.

 

Change CDN Object Metadata in HP Cloud CDN With cURL

 

If you hit the button cum dropdown named “View Details” on the Container name on HP Horizon Web GUI Admin panel, after some modification from the web GUI, you will get some data like these :

Advertisement

---

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Container Name
security-garden
Container URL
https://region-a.geo-1.objects.hpcloudsvc.com/v1/xxxxxxxxxx/security-garden
Container Access
Public (access via Container URL)
CDN URLs
http://h3eaa823f452f54f42b7273b36a68e456.cdn.hpcloudsvc.com
https://a248.e.akamai.net/cdn.hpcloudsvc.com/h3eaa823f452f54f42b7273b36a68e456/prodaw2/
CDN Time to Live
1577836800 seconds
Object Count
15
Size
72.8 KB

Note that https://region-a.geo-1.objects.hpcloudsvc.com/v1/xxxxxxxxxx/security-garden. We will need this URL. Use a test container and upload one object via GUI and publish via CDN.

xxxxxxxxxx is basically the project ID or rather OS_TENANT_ID, we are getting ready to use format as URL from Web GUI. security-garden is the container name.

If we do cURL of a file on CDN before the attempt to change any metadata :

Vim
1
http://h3eaa823f452f54f42b7273b36a68e456.cdn.hpcloudsvc.com/center_cloud.gif

We will get these data publicly :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
~  curl -I http://h3eaa823f452f54f42b7273b36a68e456.cdn.hpcloudsvc.com/center_cloud.gif
HTTP/1.1 200 OK
Last-Modified: Tue, 14 Apr 2015 22:33:26 GMT
ETag: "8f5f7aa1cb94c3953664414b35e461d0"
Content-Length: 2231
Accept-Ranges: bytes
Content-Type: image/gif
X-Trans-Id: tx81a9a8fbfc91457e85c0b-00557ad0aa
Cache-Control: public, max-age=0
Expires: Fri, 12 Jun 2015 12:29:30 GMT
Date: Fri, 12 Jun 2015 12:29:30 GMT
Connection: keep-alive

Note these two values :

Vim
1
Cache-Control: public, max-age=0

Vim
1
Expires: Fri, 12 Jun 2015 12:29:30 GMT

If any of the values – Cache-Control: public, max-age= or TTL or Expires is increased on HP Cloud OpenStack Object, it would reflect on the CDN. We can read the previous guide now and fetch the metadata internal URL. Suppose your Auth is HPAuth10_2255, then the command will be :

Vim
1
curl -i -k -X HEAD -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'X-Auth-Token: HPAuth10_2255' https://region-a.geo-1.objects.hpcloudsvc.com/v1/xxxxxxxxxx/security-garden/center_cloud.gif

Try to understand where from the xxxxxxxxxx and /security-garden came from above discussed topic. You will get this response :

Vim
1
2
3
4
5
6
7
8
9
10
HTTP/1.1 200 OK
Content-Length: 13503
Accept-Ranges: bytes
X-Object-Meta-Expires: 2380880912
Last-Modified: Fri, 12 Jun 2015 12:18:21 GMT
Etag: 3805e6d500919bd42889acde9c975363
X-Timestamp: 1434111501.57582
Content-Type: application/json
X-Trans-Id: tx8f3e106cde8e42d6b22e4-00557ad2ac
Date: Fri, 12 Jun 2015 12:38:04 GMT

We should make sure that with our username, we have the full read and write access to the container :

Vim
1
2
3
curl -X POST -H 'X-Auth-Token: HPAuth10_2255' -H 'X-Container-Read: username' https://region-a.geo-1.objects.hpcloudsvc.com/v1/10577961648287/security-garden/
#
curl -X POST -H 'X-Auth-Token: HPAuth10_2255' -H 'X-Container-Write: username' https://region-a.geo-1.objects.hpcloudsvc.com/v1/10577961648287/security-garden/

We can compose a POST request to change the metadata :

Vim
1
curl -i -k -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'X-Auth-Token: HPAuth10_225' -H 'X-CDN-Enabled: True' -H 'X-Object-Meta-Expires: 2380880912' https://region-a.geo-1.objects.hpcloudsvc.com/v1/xxxxxxxxxx/security-garden/center_cloud.gif

Change CDN Object Metadata in HP Cloud CDN With cURL

There are 03 types of Meta – X-Account-Meta, X-Container-Meta and X-Object-Meta. We can see that X-Object-Meta- in that above example and change that X-Object-Meta-Expires: 2380880912 part to :

Vim
1
2
3
4
5
X-Object-Meta-Expires
X-Object-Meta-TTL
X-TTL
X-Delete-After
X-Delete-At

X-Delete-At and X-Delete-After actually not exactly what it sounds to be.

‘X-CDN-Enabled: True’ can be omitted from the command. Only the X-Delete-At needs the unix Epoch timestamp among the variables above. Others are in seconds.

After running a command successfully, we will receive a HTTP 202 response as well as a HTML output declaring the success :

Vim
1
2
3
4
5
6
7
HTTP/1.1 202 Accepted
Content-Length: 76
Content-Type: text/html; charset=UTF-8
X-Trans-Id: txd6ff2bfcd06a4a19a15a5-00557ac7ed
Date: Fri, 12 Jun 2015 11:52:13 GMT
 
<html><h1>Accepted</h1><p>The request is accepted for processing.</p></html>%

You will get documentation on official websites OpenStack and HP Cloud.

Tagged With does a cdn have ability to keep metadata
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Change CDN Object Metadata in HP Cloud CDN With cURL

  • Changing Data With cURL for OpenStack Swift (HP Cloud CDN)

    Changing Data With cURL For Object is Quite Easy in OpenStack Swift. Here Are Examples With HP Cloud CDN To Make it Clear. Official Examples Are Bad.

  • HP Cloud CDN & DNS : Far Set Expires to Leverage Caching

    50 Years Expires May Not Work. Far Set Expires to Leverage Caching in HP Cloud CDN & DNS By Setting Container TTL to 5 Years & Same For DNS.

  • Installing cURL in Windows to Run cURL Commands Natively

    Installing cURL in Windows to Run cURL Commands Natively is actually quite easy process,a starter might find it difficult. Here is Guide to run cURL in Windows.

  • TTL or Time to Live Explained

    Time to live or TTL is the term of validity of data in a given computer networks that limits the lifespan or lifetime of data, that determines how many intermediate stations (hops) a packet of data is allowed to pass in the Internet.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy