Skip to Main Content
IBM Power Ideas Portal


This portal is to open public enhancement requests against IBM Power Systems products, including IBM i. To view all of your ideas submitted to IBM, create and manage groups of Ideas, or create an idea explicitly set to be either visible by all (public) or visible only to you and IBM (private), use the IBM Unified Ideas Portal (https://ideas.ibm.com).


Shape the future of IBM!

We invite you to shape the future of IBM, including product roadmaps, by submitting ideas that matter to you the most. Here's how it works:

Search existing ideas

Start by searching and reviewing ideas and requests to enhance a product or service. Take a look at ideas others have posted, and add a comment, vote, or subscribe to updates on them if they matter to you. If you can't find what you are looking for,

Post your ideas
  1. Post an idea.

  2. Get feedback from the IBM team and other customers to refine your idea.

  3. Follow the idea through the IBM Ideas process.


Specific links you will want to bookmark for future use

Welcome to the IBM Ideas Portal (https://www.ibm.com/ideas) - Use this site to find out additional information and details about the IBM Ideas process and statuses.

IBM Unified Ideas Portal (https://ideas.ibm.com) - Use this site to view all of your ideas, create new ideas for any IBM product, or search for ideas across all of IBM.

ideasibm@us.ibm.com - Use this email to suggest enhancements to the Ideas process or request help from IBM for submitting your Ideas.

Status Is a defect
Workspace IBM i
Categories Db2 for i
Created by Guest
Created on Nov 15, 2023

Custom HTTP Header Fields Should Replace Supplied Defaults in the QSYS2 HTTP Functions

When using the QSYS2 HTTP functions, custom HTTP request fields can be supplied.  These supplied fields should replace any defaults provided by the HTTP functions.  For example, the HTTP request field "Host" is automatically supplied by the HTTP functions.  However, if a custom header is supplied that includes the header field "Host", the HTTP functions send *both* the default value and the custom value.

In my case, I am connecting with AWS.  When using the AWs service, I must calculate a signature hash that is included in the HTTP header field "Authentication".  The hash is, in part, based on the value of the HTTP request field "Host".  In order to ensure my signature hash is calculated correctly, I would like to explicitly set the "Host" value.  For example:

```JSON
{
 "connectTimeout": 300000,
 "headers": {
   "Host": "www.myoverridehostname.com",
   "Content-Type": "application/json",
   "Authentication": "AWS <accesskey>:<signaturehash>"
 }
}
```

Instead of replacing the supplied default "Host", my "Host" is added to the HTTP request header, effectively yielding:
 

```JSON
{
 "connectTimeout": 300000,
 "headers": {
   "Host": "<DEFAULT-HOST-SUPPLIED-BY-HTTP-FUNCTION>",
   "Host": "www.myoverridehostname.com",
   "Content-Type": "application/json",
   "Authentication": "AWS <accesskey>:<signaturehash>"
 }
}
```

The duplicate "Host" HTTP header field causes the request to fail authentication.

As stated above, custom HTTP header fields should *replace* any supplied defaults.  Also keep in mind that HTTP request field names are case-insensitive.  That is, "host", "HOST", and "HoSt" are all valid names for the official HTTP header field "Host".

NOTE:
If the HTTP request header field "Host" cannot be overridden because of a security concern, that fact should be stated in the HTTP function documentation.  Additionally, if the "Host" cannot be overridden, then a new function should be provided to allow the retrieval of the "Host" name (value).

Idea priority Medium
  • Admin
    Sabine Jordan
    Reply
    |
    Jan 17, 2024

    The CEAC has reviewed this requirement and an considers it a bug that should be fixed.

    Background: The COMMON Europe Advisory Council (CEAC) members have a broad range of experience in working with small and medium-sized IBM i customers. CEAC has a crucial role in working with IBM i development to help assess the value and impact of individual RFEs on the broader IBM i community and has therefore reviewed your RFE.

    To find out how CEAC help to shape the future of IBM i, see CEAC @ ibm.biz/BdYSYj and the article "The Five Hottest IBM i RFEs Of The Quarter" at ibm.biz/BdYSZT

    Sabine Jordan + Sara Andres – CEAC Program Manager, IBM

  • Guest
    Reply
    |
    Dec 18, 2023

    As a subscriber to this IDEA, now that it will become a defect, how would I get informed that a PTF is made available?

  • Guest
    Reply
    |
    Dec 18, 2023
    Thank you for continuing the conversation. We got a few more developers involved in the discussion, and have concluded this is actually a bug that should be fixed.

    The proposed fix is that if Host is set, it will be honored. The port will still be used from the specified URL.

    Please open a ticket through support.

    Closing this Idea now, since the change will be provided through the support process.

    Db2 for i development team
    IBM Power Systems Development
  • Guest
    Reply
    |
    Dec 15, 2023

    Thank you for your feedback.

    Documentation:

    Yes, the documentation states that "By default only the Host and User-Agent HTTP headers are set...". This is misleading. The use of the word "default" implies that the values can be overridden. This is not the case. Instead, both the "default" values and the user-supplied custom values are sent. As mentioned, having duplicate header fields for Host and (I assume) user-Agent causes a security issue.

    If these header fields cannot be overridden, the documentation should clear state that these header values are always added to each request and, for security reasons, cannot be overridden.


    Retrieval of Host Name:

    As for retrieval of the host name, you mention that one "should be able to extract the Host value from the URL supplied for the HTTP request". The URL provided for the HTTP request is the for the remote host I am connecting with; not the local IBM i host. For example:

    SELECT * 
    FROM TABLE(qsys2.http_get_verbose(
    'https://openlibrary.org/search.json?q=the+lord+of+the+rings', '')) a

    The above SQL statement will retrieve book information about "The Lord of the Rings". Obviously, the URL contains the remote server's host name, "openlibrary.org". This does not tell me what the Host value supplied in the HTTP request would be.

    I must be missing something in your response. Can you let me know what URL I am supposed to interrogate to get the value of the Host header field that is "defaulted" by the HTTP functions?

    1 reply
  • Guest
    Reply
    |
    Dec 15, 2023
    IBM needs more information to further assess your Idea. We want to verify that we understand what you are asking for.

    It sounds like you want to pass a Host value that is different than the host name in the URL. This is not possible with our implementation.

    The documentation today that describes the headers option is here.
    https://www.ibm.com/docs/en/i/7.5?topic=functions-http-get-http-get-blob
    It says
    By default, only the Host and User-Agent HTTP header are set for all requests. The Host is set using the host information in the URL.

    You should be able to extract the Host value from the URL supplied for the HTTP request. While IBM could provide a new function to get the host name from the URL, this is an enhancement that would not get ranked as a high value request which might not get delivered for many years. Recognizing this, we would recommend that you write your own substring-based function to extract the host name from the URL.


    Db2 for i development team
    IBM Power Systems Development