2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-11-10 15:20:55 +00:00
Commit Graph

8 Commits

Author SHA1 Message Date
Revant Nandgaonkar
251d6590cf fix: nginx config
use $scheme://$http_host instead of $http_referer
fixes socketio
2020-07-06 14:44:52 +05:30
Javier López
4e26ca653c fix: use remote_addr instead of header ip 2020-06-17 14:37:38 -05:00
paulator
52dbc49c21
Fix socketio error in reverse proxy setup 2020-05-06 11:11:55 +02:00
girish pasupathy
87c251a464 Changed X-Frappe-Site-Name header to use value from $host instead of $http_host in nginx configuration
ISSUE
-----
`$http_host` is used for setting header 'X-Frappe-Site-Name'
which adds port number to the header along with the host value. Frappe source app.py expects the header
value to contain only the host name and not the port number. So `$host` should be used instead of
`$http_host` to set the 'X-Frappe-Site-Name' header

`$http_host` vs `$host` in nginx
--------------------------------
`$http_host` contains the host name along with port number whereas `$host` contains only the host name in lowercase without the port number.

> `$host` - This variable is equal to line Host in the header of request or
> name of the server processing the request if the Host header is not available.
> This variable may have a different value from $http_host in such cases:
> * when the Host input header is absent or has an empty value,
> `$host` equals to the value of server_name directive;
> * when the value of Host contains port number, `$host` doesn't include
> that port number. $host's value is always lowercase since 0.8.17.
> - [$host vs $http_host stackoverflow](https://stackoverflow.com/questions/15414810/whats-the-difference-of-host-and-http-host-in-nginx)

From the frappe source file [app.py](https://github.com/frappe/frappe/blob/develop/frappe/app.py#L107), X-Frappe-Site-Name is used if its set.

```Python
site = _site or request.headers.get('X-Frappe-Site-Name') or get_site_name(request.host)
```

Since `$host` variable will never contain port number which is not the case with `$http_host`,
`$host` should be used for setting the header 'X-Frappe-Site-Name'. Otherwise we have issues with site serving.

Tested the above changes in compose as well as in swarm environment.
In compose, tested the site with host mapping of 80 and 8000. Works with both the host port mapping.

Tested with erpnext version - v12.5.2

Changes to be committed:
	modified:   build/common/nginx-default.conf.template
2020-04-09 18:58:34 +05:30
Revant Nandgaonkar
6e8d2bf7c2 fix: nginx config
add updates from frappe/bench to config
2020-03-15 00:20:28 +05:30
Revant Nandgaonkar
0df0d6d11f fix: use SOCKETIO_PORT instead of FRAPPE_SOCKETIO_PORT 2020-03-02 05:09:57 +05:30
Revant Nandgaonkar
9b6a641f4d fix: config generation
fix envsubst single quote SHELL-FORMAT
env var changed from ERPNEXT_PY to FRAPPE_PY
2020-02-20 21:48:51 +05:30
Revant Nandgaonkar
242708df0c refactor: reuse common scripts and files
move common scripts to build/common
2020-02-20 18:01:23 +05:30