Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch: Cross-Origin Requests #427

Merged
merged 23 commits into from
Oct 30, 2020
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e396038
se actualiza con la version en ingles
MaskeZen Oct 6, 2020
ca6607b
traduccion parcial
MaskeZen Oct 16, 2020
70ecc20
corss-origin-request articulo completo
MaskeZen Oct 19, 2020
ac12441
se agrega task y solution
MaskeZen Oct 21, 2020
576213a
Merge branch 'master' into cross-origin-requests
joaquinelio Oct 22, 2020
538975a
Update 5-network/05-fetch-crossorigin/article.md
MaskeZen Oct 23, 2020
f134240
Update 5-network/05-fetch-crossorigin/1-do-we-need-origin/solution.md
MaskeZen Oct 23, 2020
15fe5de
Update 5-network/05-fetch-crossorigin/article.md
MaskeZen Oct 23, 2020
769cf76
Update 5-network/05-fetch-crossorigin/article.md
MaskeZen Oct 23, 2020
86fa874
Update 5-network/05-fetch-crossorigin/article.md
MaskeZen Oct 23, 2020
6cbb169
Update 5-network/05-fetch-crossorigin/article.md
MaskeZen Oct 23, 2020
cc63b61
Update 5-network/05-fetch-crossorigin/article.md
MaskeZen Oct 23, 2020
5547fd8
Update 5-network/05-fetch-crossorigin/article.md
MaskeZen Oct 23, 2020
14f1e35
Update 5-network/05-fetch-crossorigin/article.md
MaskeZen Oct 23, 2020
11060b4
Update 5-network/05-fetch-crossorigin/article.md
MaskeZen Oct 23, 2020
d2a3367
Update 5-network/05-fetch-crossorigin/article.md
MaskeZen Oct 23, 2020
3bdb479
Update 5-network/05-fetch-crossorigin/article.md
MaskeZen Oct 23, 2020
503f717
Update 5-network/05-fetch-crossorigin/article.md
MaskeZen Oct 23, 2020
939b5ae
Update 5-network/05-fetch-crossorigin/article.md
MaskeZen Oct 23, 2020
a12276f
Update 5-network/05-fetch-crossorigin/article.md
MaskeZen Oct 23, 2020
3114ca5
Update Cross-Origin Request #427
MaskeZen Oct 27, 2020
2d4d85f
update cross-origin-request
MaskeZen Oct 27, 2020
106425e
update cross-origin-request
MaskeZen Oct 27, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions 5-network/05-fetch-crossorigin/1-do-we-need-origin/solution.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
We need `Origin`, because sometimes `Referer` is absent. For instance, when we `fetch` HTTP-page from HTTPS (access less secure from more secure), then there's no `Referer`.
Necesitamos la cabecera `Origin`, ya que en algunos casos `Referer` no está presente. Por ejemplo, cuando realizamos un `fetch` a una página HTTP desde una HTTPS (acceder a un sitio menos seguro desde uno más seguro), en ese caso no tendremos el campo `Referer`.

The [Content Security Policy](http://en.wikipedia.org/wiki/Content_Security_Policy) may forbid sending a `Referer`.
La [Política de seguridad de contenido](http://en.wikipedia.org/wiki/Content_Security_Policy) puede prohibir el envío de `Referer`.

As we'll see, `fetch` has options that prevent sending the `Referer` and even allow to change it (within the same site).
Como veremos, `fetch` tiene opciones con las que es posible evitar el envío de `Referer` e incluso permite su modificación (dentro del mismo sitio).

By specification, `Referer` is an optional HTTP-header.
Por especificación, `Referer` es una cabecera HTTP opcional.

Exactly because `Referer` is unreliable, `Origin` was invented. The browser guarantees correct `Origin` for cross-origin requests.
Por el hecho de que `Referer` no es confiable, la cabecera `Origin` ha sido creada. El navegador garantiza el envío correcto de `Origin` para las solicitudes de origen cruzado.
18 changes: 9 additions & 9 deletions 5-network/05-fetch-crossorigin/1-do-we-need-origin/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ importance: 5

---

# Why do we need Origin?
# ¿Por que necesitamos el origen (Origin)?

As you probably know, there's HTTP-header `Referer`, that usually contains an url of the page which initiated a network request.
Como seguramente ya sepas, existe la cabecera HTTP `Referer`, la cual por lo general contiene la url del sitio que generó la solicitud.

For instance, when fetching `http://google.com` from `http://javascript.info/some/url`, the headers look like this:
Por ejemplo, cuando solicitamos la url `http://google.com` desde `http://es.javascript.info/alguna/url`, las cabeceras se ven de este modo:

```
Accept: */*
Expand All @@ -15,14 +15,14 @@ Accept-Encoding: gzip,deflate,sdch
Connection: keep-alive
Host: google.com
*!*
Origin: http://javascript.info
Referer: http://javascript.info/some/url
Origin: http://es.javascript.info
Referer: http://es.javascript.info/alguna/url
*/!*
```

As you can see, both `Referer` and `Origin` are present.
Tal como se puede ver, tanto `Referer` como `Origin` están presentes.

The questions:
Las preguntas:

1. Why `Origin` is needed, if `Referer` has even more information?
2. Is it possible that there's no `Referer` or `Origin`, or is it incorrect?
1. ¿Por que la cabecera `Origin` es necesaria, si `Referer` contiene incluso más información?
MaskeZen marked this conversation as resolved.
Show resolved Hide resolved
2. ¿Es posible que no se incluya `Referer` u `Origin`, o que contengan datos incorrectos?
Loading