RapidAPI Profile picture
Feb 15 β€’ 16 tweets β€’ 3 min read
What exactly is an HTTP Cookie.

Thread πŸ§΅πŸ‘‡πŸ»
Have you ever imagined how you stay logged in even after you close the tab?

Or how do items stay in your cart when you refresh or close a tab?

The answer is cookies.
HTTP cookies, also known as web cookies or browser cookies, are nothing but a piece of data that the server sends to the browser.
Although HTTP protocol itself is stateless, meaning no connection between two successive requests.

But HTTP cookies allow us to store meaningful states.
Session management, like login, shopping carts, score, is the widespread use case of HTTP cookies.
We can use cookies for the client-side storage but it is not recommended as they are sent with every request which may slow down the computer performance.
We have Web Storage API like localStorage and sessionStorage for client-side storage.
After you make an HTTP request, the server sends the cookies using `Set-Cookie` HTTP header.

One thing to note here is that server can send as many `Set-Cookie` headers as required.
Here is how a simple cookie is sent by the server. πŸ‘‡πŸ» Set-Cookie HTTP Header.
The browser sends the stored cookies with the request using `Cookie` HTTP header.

We can mention one or more cookies inside the `Cookie` header.

Here's a typical syntax. HTTP cookie header with user_id and session_id cookies.
Cookies are generally meant to stay for a shorter amount of time. However, you can mention the time periods.

The session cookie expires when the current session is closed.
You can use `Expires` or `Max-Age` HTTP headers to define the lifecycle of a particular cookie.
There is always a security risk in cookies as the data stored is accessible and mutable by the users.

You can use the two methods below to minimize the attack. πŸ‘‡πŸ»
1️⃣ Use httpOnly attribute

The `httpOnly` attribute prevents accessing cookies by the client-side script. httpOnly attribute to prevent data accessibility to client-s
2️⃣ Use SameSite attribute

Use `SameSite=Strict` to prevent from cookies being sent with cross-site requests. SameSite=Strict to prevent cross-origin cookie sharing.
With that being said, this is pretty much it for this thread.

Follow @Rapid_API for more exclusive content. πŸ’™πŸ™

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with RapidAPI

RapidAPI Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @Rapid_API

Feb 16
Top ten Text Analysis APIs.

Thread πŸ§΅πŸ‘‡πŸ»
1️⃣ Sentiment Analysis

Enter a string to check the positive or negative tone.

RapidAPI.com/twinword/api/s…
2️⃣ Text-Processing

This API provides sentiment analysis, stemming and lemmatization, part-of-speech tagging and chunking, phrase extraction, and named entity recognition.

RapidAPI.com/japerk/api/tex…
Read 12 tweets
Feb 16
An HTTP cache is crucial for making your website fast.

Let's discuss everything about HTTP cache in a bit more detail.

Thread πŸ§΅πŸ‘‡πŸ»
Most websites you visit fetch data from the backend to display it on the web page.

Continuous calls to the server can make your website slow and hence worst User Experience.
This is where cache comes into the picture.

Cache is a technique using which the browser can store the resources in the local storage, reducing the number of round trips to the server.
Read 14 tweets
Feb 14
Top ten Finance APIs you can use in your next project.

A Thread πŸ§΅πŸ‘‡πŸ»
1️⃣ Alpha Vantage

- The simplest and most effective way to receive stock, ETF, forex, technical indicators, and cryptocurrency data.

πŸ”— RapidAPI.com/alphavantage/a…
2️⃣ Currency Converter

- Provides exchange rates based on the official bank's data.

πŸ”— RapidAPI.com/natkapral/api/…
Read 11 tweets
Feb 11
A complete Introduction to Fetch API.

Thread πŸ§΅πŸ‘‡πŸ»
Fetch is a web API that provides an interface to fetch resources across the networks.

For making a request, we have the `fetch()` method.
The fetch method is entirely based on `promises` that can be resolved to the request's response.

Before moving further, let's talk a little bit about Promises. πŸ‘‡πŸ»
Read 12 tweets
Feb 10
Project-based learning is the way to improve your coding skills.

Use these ten excellent Flight APIs and build great projects.

Thread πŸ§΅πŸ‘‡πŸ»
1️⃣ AeroDataBox

- This API provides you with flight status, flight delays, schedules, airport, and much more.

πŸ”— RapidAPI.com/aerodatabox/ap…
2️⃣ ADSBx Flight Sim Traffic

- Provides actual real-world traffic data use in flight simulators.

πŸ”— RapidAPI.com/adsbx/api/adsb…
Read 12 tweets
Feb 8
What exactly is CORS.

Thread πŸ§΅πŸ‘‡πŸ»
CORS is an HTTP-based mechanism that lets you request data from one URL to a different URL.
CORS stands for Cross-Origin Resource Sharing.

Half of the definition is clear by the abbreviation. CORS allows a server to share resources with browsers having different origins.
Read 20 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

:(