Skip to content

Commit a1ff708

Browse files
authored
Add nginx auth remedial step (#100)
1 parent 7a2c7b1 commit a1ff708

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

frequently-asked-questions.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,22 @@ Adding `$is_args` (which will print a ? character if query arguments are found)
9999

100100
## Why is Authentication not working?
101101

102-
If you're finding that you are sending Authentication headers but the request is not being accepted, and you're using Apache in a CGI environment, Apache may be stripping the headers. Try adding this to a configuration file or .htaccess:
102+
If you're finding that you are sending Authentication headers but the request is not being accepted, and you are using a CGI environment, your webserver may be stripping the headers. Please try adding the appropriate configuration below to remedy this.
103103

104+
### Apache
105+
Add the following to a configuration file or .htaccess:
104106
```
105107
<IfModule mod_setenvif>
106108
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
107109
</IfModule>
108110
```
109111

112+
### Nginx
113+
Add the following to your server configurations fastcgi section:
114+
```
115+
fastcgi_pass_header Authorization;
116+
```
117+
110118
## Why is the REST API not verifying the incoming Origin header? Does this expose my site to CSRF attacks?
111119

112120
Cross-Origin Resource Sharing (CORS) is a mechanism which allows a website to control which Origins (originating external sites) are allowed to access your site's data. CORS prevents against a particular type of attack known as Cross-Site Request Forgery, or CSRF. However, WordPress has an existing CSRF protection mechanism which uses [nonces](https://developer.wordpress.org/plugins/security/nonces/). Tightening CORS restrictions would prevent some authentication methods, so the WordPress REST API uses nonces for CSRF protection instead of CORS.

0 commit comments

Comments
 (0)