Anypoint proxy appears to overwrite request headers


#1

In my RAML file, I’ve specified request headers for GET, for example:

host:

      example: abc.host.example.net

(In my RAML file, it’s something similar to the above but I’ve made the URL look generic here to avoid exposing the actual URL I’m using.)

When I use the Try it button to test the GET, and capture the request using Chrome dev tools, I find that:

  1. The header I specified is overwritten.

     Host: anypoint.mulesoft.com
    
  2. Custom headers I have added are dropped from the request.

I am attempting to use an API that needs the request headers to be what I specify in the RAML file.

Is the Anypoint proxy overwriting my headers, as it seems to be doing?

dev tools tells me that the request URL is now:

https://anypoint.mulesoft.com/apiplatform/proxy/https://abc.host.example.net/whatevers/9871/foo

Is there any way to ensure that the request headers specified in my RAML actually reach my server at https://abc.host.example.net/whatevers/9871/foo?


#2

I’m not sure I’m getting the problem.
Do you have any way of sharing the entire RAML file?

Best Regards.


#3

Here is the relevant chunk of the RAML file:

    resourceTypes:
  - collection:
      description: | 
        Collection of available <<resourcePathName>>. <br /> <br /> POST creates an <<resourcePathName|!singularize>>. GET shows an index. 
      get:
        description: Get a list of <<resourcePathName>>.
        headers:
          accept: 
            example: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
          accept-encoding: 
            example: gzip,deflate,sdch
          accept-language:
            example: en-US,en;q=0.8
          connection:
            example: keep-alive
          host:
            example: abc.somehost.example.net
          user-agent:
            example: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36
          x-custom-test-header:
            displayName: X-Custom-Test-Header 
            example: this-is-a-test-header
        responses:
          200:
            body:
              application/json:
                example: |
                  <<exampleCollection>>
          500:
            body:
              application/json:
                example: |
                  {"message": "internal server error" }

Request headers are specified for the GET method of the collection resource type.

When I use Try it with GET and look at what headers the browser is actually sending (captured with Chrome dev tools), the headers specified in the RAML are ignored.

I would like to know why that is, and whether there is a way to ensure that the request headers in the RAML are actually used.

Is that clearer? Thanks much for looking!


#4

Yes it is. In fact, I’m seeing the same problem with SOME headers (others are OK).

As seen in the attached image:

  • accept: OK
  • accept-encoding: FAIL
  • accept-language: OK
  • connection: FAIL
  • host: FAIL
  • x-custom-test-header: OK

I’m reporting this internally to be checked ASAP.
Thanks for opening the thread and clarifying!


#5

After discussing with @scordatura I believe his original issue was a misleading UI in the console: the example values for the headers were shown in gray in the console’s form fields, and he interpreted that as being auto-filled while in fact the fields were empty and awaiting him to fill them. Once he understood and filled them, they were submitted just fine. The new console, soon to be released, will address this usability issue.