-
Notifications
You must be signed in to change notification settings - Fork 22.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix triple dots for <pre> in Web/HTTP
- Loading branch information
Showing
268 changed files
with
2,207 additions
and
1,505 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,7 +54,7 @@ The {{HTTPHeader("WWW-Authenticate")}} and {{HTTPHeader("Proxy-Authenticate")}} | |
|
||
The syntax for these headers is the following: | ||
|
||
```html | ||
``` | ||
WWW-Authenticate: <type> realm=<realm> | ||
Proxy-Authenticate: <type> realm=<realm> | ||
``` | ||
|
@@ -65,7 +65,7 @@ Here, `<type>` is the authentication scheme ("Basic" is the most common scheme a | |
|
||
The {{HTTPHeader("Authorization")}} and {{HTTPHeader("Proxy-Authorization")}} request headers contain the credentials to authenticate a user agent with a (proxy) server. Here, the `<type>` is needed again followed by the credentials, which can be encoded or encrypted depending on which authentication scheme is used. | ||
|
||
```html | ||
``` | ||
Authorization: <type> <credentials> | ||
Proxy-Authorization: <type> <credentials> | ||
``` | ||
|
@@ -103,30 +103,36 @@ To password-protect a directory on an Apache server, you will need a `.htaccess` | |
|
||
The `.htaccess` file typically looks like this: | ||
|
||
AuthType Basic | ||
AuthName "Access to the staging site" | ||
AuthUserFile /path/to/.htpasswd | ||
Require valid-user | ||
``` | ||
AuthType Basic | ||
AuthName "Access to the staging site" | ||
AuthUserFile /path/to/.htpasswd | ||
Require valid-user | ||
``` | ||
|
||
The `.htaccess` file references a `.htpasswd` file in which each line consists of a username and a password separated by a colon (`:`). You cannot see the actual passwords as they are [hashed](https://httpd.apache.org/docs/2.4/misc/password_encryptions.html) (using MD5-based hashing, in this case). Note that you can name your `.htpasswd` file differently if you like, but keep in mind this file shouldn't be accessible to anyone. (Apache is usually configured to prevent access to `.ht*` files). | ||
|
||
aladdin:$apr1$ZjTqBB3f$IF9gdYAGlMrs2fuINjHsz. | ||
user2:$apr1$O04r.y2H$/vEkesPhVInBByJUkXitA/ | ||
``` | ||
aladdin:$apr1$ZjTqBB3f$IF9gdYAGlMrs2fuINjHsz. | ||
user2:$apr1$O04r.y2H$/vEkesPhVInBByJUkXitA/ | ||
``` | ||
|
||
### Restricting access with nginx and basic authentication | ||
|
||
For nginx, you will need to specify a location that you are going to protect and the `auth_basic` directive that provides the name to the password-protected area. The `auth_basic_user_file` directive then points to a `.htpasswd` file containing the encrypted user credentials, just like in the Apache example above. | ||
|
||
location /status { | ||
auth_basic "Access to the staging site"; | ||
auth_basic_user_file /etc/apache2/.htpasswd; | ||
} | ||
``` | ||
location /status { | ||
auth_basic "Access to the staging site"; | ||
auth_basic_user_file /etc/apache2/.htpasswd; | ||
} | ||
``` | ||
|
||
### Access using credentials in the URL | ||
|
||
Many clients also let you avoid the login prompt by using an encoded URL containing the username and the password like this: | ||
|
||
```plain example-bad | ||
```example-bad | ||
https://username:[email protected]/ | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,22 +26,28 @@ The target of an HTTP request is called a "resource", whose nature isn't defined | |
|
||
The most common form of URI is the Uniform Resource Locator ({{Glossary("URL")}}), which is known as the _web address_. | ||
|
||
https://developer.mozilla.org | ||
https://developer.mozilla.org/en-US/docs/Learn/ | ||
https://developer.mozilla.org/en-US/search?q=URL | ||
``` | ||
https://developer.mozilla.org | ||
https://developer.mozilla.org/en-US/docs/Learn/ | ||
https://developer.mozilla.org/en-US/search?q=URL | ||
``` | ||
|
||
Any of those URLs can be typed into your browser's address bar to tell it to load the associated page (resource). | ||
|
||
A URL is composed of different parts, some mandatory and others are optional. A more complex example might look like this: | ||
|
||
http://www.example.com:80/path/to/myfile.html?key1=value1&key2=value2#SomewhereInTheDocument | ||
``` | ||
http://www.example.com:80/path/to/myfile.html?key1=value1&key2=value2#SomewhereInTheDocument | ||
``` | ||
|
||
### URNs | ||
|
||
A Uniform Resource Name (URN) is a URI that identifies a resource by name in a particular namespace. | ||
A Uniform Resource Name (URN) is a URI that identifies a resource by name in a particular namespace. | ||
|
||
urn:isbn:9780141036144 | ||
urn:ietf:rfc:7230 | ||
``` | ||
urn:isbn:9780141036144 | ||
urn:ietf:rfc:7230 | ||
``` | ||
|
||
The two URNs correspond to | ||
|
||
|
@@ -102,12 +108,14 @@ FTP is still acceptable at the top level (such as typed directly into the browse | |
|
||
## Examples | ||
|
||
https://developer.mozilla.org/en-US/docs/Learn | ||
tel:+1-816-555-1212 | ||
[email protected]:mdn/browser-compat-data.git | ||
ftp://example.org/resource.txt | ||
urn:isbn:9780141036144 | ||
mailto:[email protected] | ||
``` | ||
https://developer.mozilla.org/en-US/docs/Learn | ||
tel:+1-816-555-1212 | ||
[email protected]:mdn/browser-compat-data.git | ||
ftp://example.org/resource.txt | ||
urn:isbn:9780141036144 | ||
mailto:[email protected] | ||
``` | ||
|
||
## Specifications | ||
|
||
|
Oops, something went wrong.