Skip to content

Commit b93f720

Browse files
authored
Merge pull request #17 from guardian/first-server-defaulting-faq
FAQ to remind people to define both protocols
2 parents bfead5b + f722d58 commit b93f720

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ This typically allows accessing servers via
66
`service.local.dev-gutools.co.uk`, rather than a `localhost:PORT` URL,
77
which among other things makes it possible to share cookies for the [pan-domain authentication](https://github.com/guardian/pan-domain-authentication).
88

9+
### Strange errors or behaviour
10+
See [troubleshooting faq](TROUBLESHOOTING.md)
11+
912
### What does dev-nginx do?
1013

1114
Installing and running dev-nginx will start an [nginx](https://nginx.org/en/) server instance locally on your machine.

TROUBLESHOOTING.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# Troubleshooting
22

3+
## Hitting one hostname actually tries to serve another
4+
This can happen if you don't use the standard [setup-app command](README.md#setup-app)
5+
6+
`$ tail /usr/local/var/log/nginx/error.log`
7+
shows something like this
8+
9+
`2020/04/03 13:37:13 [error] 51098#0: *5 kevent() reported that connect() failed (61: Connection refused) while connecting to upstream, client: 127.0.0.1, server: promo.thegulocal.com, request: "GET / HTTP/1.1", upstream: "http://[::1]:9500/", host: "mem.thegulocal.com"`
10+
11+
you can see the correct host mem.thegulocal.com, but the incorrect server and port number promo.thegulocal.com and 9500.
12+
13+
This is because if nginx can't find a matching server block for host AND protocol, it just picks the first one, which in this case is promo. If you access with https it works fine, but be sure to define the http as well as the https in your [nginx config file](https://github.com/guardian/membership-frontend/blob/master/nginx/membership.conf) if you want the redirect to work:
14+
```
15+
server {
16+
server_name mem.thegulocal.com;
17+
18+
location / {
19+
proxy_pass http://localhost:9100/;
20+
proxy_set_header Host $http_host;
21+
}
22+
}
23+
```
24+
25+
## Hash bucket size emerg
326
Seeing a message such as `nginx: [emerg] could not build server_names_hash, you should increase server_names_hash_bucket_size: 64` after starting nginx
427
is a sign that an unusually long server name has been defined.
528

@@ -13,4 +36,4 @@ http {
1336
}
1437
```
1538

16-
See [the docs](https://nginx.org/en/docs/http/server_names.html#optimization) for more information.
39+
See [the docs](https://nginx.org/en/docs/http/server_names.html#optimization) for more information.

0 commit comments

Comments
 (0)