Add option for using Real-IP
This commit is contained in:
parent
9ac016c3b5
commit
2b0135697b
@ -29,6 +29,7 @@ Command-line options
|
||||
- ```-filecontentsecuritypolicy "..."``` -- Content-Security-Policy header for files (default is "default-src 'none'; img-src 'self'; object-src 'self'; media-src 'self'; sandbox; referrer none;"")
|
||||
- ```-xframeoptions "..." ``` -- X-Frame-Options header (default is "SAMEORIGIN")
|
||||
- ```-remoteuploads``` -- (optionally) enable remote uploads (/upload?url=https://...)
|
||||
- ```-realip``` -- (optionally) let linx-server know you (nginx, etc) are providing the X-Real-IP and/or X-Forwarded-For headers.
|
||||
- ```-fastcgi``` -- (optionally) serve through fastcgi
|
||||
- ```-nologs``` -- (optionally) disable request logs in stdout
|
||||
|
||||
@ -48,8 +49,6 @@ server {
|
||||
|
||||
client_max_body_size 4096M;
|
||||
location / {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
fastcgi_pass 127.0.0.1:8080;
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ var Config struct {
|
||||
fileContentSecurityPolicy string
|
||||
xFrameOptions string
|
||||
maxSize int64
|
||||
realIp bool
|
||||
noLogs bool
|
||||
allowHotlink bool
|
||||
fastcgi bool
|
||||
@ -48,7 +49,7 @@ func setup() *web.Mux {
|
||||
// middleware
|
||||
mux.Use(middleware.RequestID)
|
||||
|
||||
if Config.fastcgi {
|
||||
if Config.realIp {
|
||||
mux.Use(middleware.RealIP)
|
||||
}
|
||||
|
||||
@ -152,6 +153,8 @@ func main() {
|
||||
"path to ssl certificate (for https)")
|
||||
flag.StringVar(&Config.keyFile, "keyfile", "",
|
||||
"path to ssl key (for https)")
|
||||
flag.BoolVar(&Config.realIp, "realip", false,
|
||||
"use X-Real-IP/X-Forwarded-For headers as original host")
|
||||
flag.BoolVar(&Config.fastcgi, "fastcgi", false,
|
||||
"serve through fastcgi")
|
||||
flag.BoolVar(&Config.remoteUploads, "remoteuploads", false,
|
||||
|
Loading…
Reference in New Issue
Block a user