I'm trying to understand the difference between querystrings and headers. Where do you use each?
Query strings might be more useful in making URLs human readable I suppose, but other than that, wouldn't it be easier to just embed that in your own custom HTTP header (side question, but how this relate to cookies?)? What's the distinction between the two?
From the security point of view, there's no difference on using HTTP Header vs Query Param since both are encrypted when using TLS/SSL. But query params can be more fragile since it can be easily visible in browsers, are logged across the board by default (browser history, web servers access logs and etc).
An HTTP header is a field of an HTTP request or response that passes additional context and metadata about the request or response. For example, a request message can use headers to indicate it's preferred media formats, while a response can use header to indicate the media format of the returned body.
A querystring is a set of characters input to a computer or Web browser and sent to a query program to recover specific information from a database .
Refer a similar question Adding Custom HTTP Headers
Why would I prefer query string over http-header fields?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With