Possibility to use underscores in Published service HTTP Request Header - Mendix Forum

Possibility to use underscores in Published service HTTP Request Header

0

Hi, 

I would like to suggest to enable the underscores_in_headers tag in Mendix server. While implementing a published rest service I found out that if you add a custom HTTP Request Header to your API calls it must not contain an underscore. In the documentation I didn't find anyting about this, I found only a post in the community talking about this. In local it all seems to work just fine, but as you deploy to a test environment the HTTP Header disappears. As it can be very time consuming to find out I would like to suggest  turn the tag on in the next releases or at least write it explicitely in the documentation.

 

Thank you, 

Denise

asked
3 answers

Mendix is not very consistent with header parsing. According to RFC 7230 : https://www.rfc-editor.org/rfc/rfc7230#section-3.2, underscore should be allowed, so maybe you should file a support ticket to find out if it's Mendix not accepting the header or if it's actually the webserver (nginx?) that filters it out?

Same like headers should be case insensititve according to the RFC, but Mendix treats them as case sensistive (and even camel cases the results when parsing).

So if I recall from memory, a header that's being sent like X-made-up-header, will be transformed into X-Made-Up-Header.... so when you search for x-made-up-header or the originally sent one: X-made-up-header, you don't find the header at all. We ended up lowercasing all headers before looping through them to check if a certain header was present, but it's not ideal.

 

Created

@Joost Verhoog yes it is actually an idea. I resolved replacing the underscore with a "-". My biggest problem  was that I didn't find anything about this problem in the documentation. As a matter of fact it isn't written anywhere so I found it out accidentally when I had already lost a lot of time trying to find a solution. 

Created

It's uncommon to have underscores in headers names. Is it an option to change the name of the header to use more conventional dashes?

Created