Skip to content

Commit f4ad11d

Browse files
authored
Merge pull request src-d#167 from camathieu/1.2
DownloadDomain log message, and README FAQ update
2 parents 46542f5 + 43e93aa commit f4ad11d

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

README.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ See the [Plik Docker reference](documentation/docker.md)
213213

214214
### FAQ
215215

216-
##### Why is stream mode broken in multiple instance deployement ?
216+
* Why is stream mode broken in multiple instance deployement ?
217217

218218
Beacause stream mode isn't stateless. As the uploader request will block on one plik instance the downloader request **MUST** go to the same instance to succeed.
219219
The load balancing strategy **MUST** be aware of this and route stream requests to the same instance by hashing the file id.
@@ -253,7 +253,21 @@ server {
253253
}
254254
```
255255

256-
##### I have an error when uploading from client : "Unable to upload file : HTTP error 411 Length Required"
256+
* Redirection loops with DownloadDomain enforcement and reverse proxy
257+
258+
```
259+
Invalid download domain 127.0.0.1:8080, expected plik.root.gg
260+
```
261+
262+
DownloadDomain check the Host header of the incoming HTTP request, by default reverse proxies like
263+
Nginx or Apache mod_proxy does not forward this Header. Check the following configuration directive :
264+
265+
```
266+
Apache mod_proxy : ProxyPreserveHost On
267+
Nginx : proxy_set_header Host $host;
268+
```
269+
270+
* I have an error when uploading from client : "Unable to upload file : HTTP error 411 Length Required"
257271

258272
Under nginx < 1.3.9, you must enable HttpChunkin module to allow transfer-encoding "chunked".
259273
You might want to install the "nginx-extras" Debian package with built-in HttpChunkin module.
@@ -268,7 +282,7 @@ And add in your server configuration :
268282
}
269283
```
270284

271-
##### How to disable nginx buffering ?
285+
* How to disable nginx buffering ?
272286

273287
By default nginx buffers large HTTP requests and reponses to a temporary file. This behaviour leads to unnecessary disk load and slower transfers. This should be turned off (>1.7.12) for /file and /stream paths. You might also want to increase buffers size.
274288

@@ -282,11 +296,11 @@ Detailed documentation : http://nginx.org/en/docs/http/ngx_http_proxy_module.htm
282296
client_body_buffer_size 1M;
283297
```
284298

285-
##### Why authentication don't work with HTTP connections ?
299+
* Why authentication don't work with HTTP connections ?
286300

287301
Plik session cookies have the "secure" flag set, so they can only be transmitted over secure HTTPS connections.
288302

289-
##### How to take and upload screenshots like a boss ?
303+
* How to take and upload screenshots like a boss ?
290304

291305
```
292306
alias pshot="scrot -s -e 'plik -q \$f | xclip ; xclip -o ; rm \$f'"
@@ -297,7 +311,7 @@ scroot -s allow you to "Interactively select a window or rectangle with the mous
297311
Plik will upload the screenshot and the url will be directly copied to your clipboard and displayed by xclip.
298312
The screenshot is then removed of your home directory to avoid garbage.
299313

300-
##### How to contribute to the project ?
314+
* How to contribute to the project ?
301315

302316
Contributions are welcome, feel free to open issues and/or submit pull requests.
303317
Please make your pull requests against the current development (RC) branch, not against master.

server/handlers/getFile.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,11 @@ func GetFile(ctx *juliet.Context, resp http.ResponseWriter, req *http.Request) {
5050
// If a download domain is specified verify that the request comes from this specific domain
5151
if common.Config.DownloadDomainURL != nil {
5252
if req.Host != common.Config.DownloadDomainURL.Host {
53-
downloadURL := fmt.Sprintf("%s://%s/%s",
53+
downloadURL := fmt.Sprintf("%s://%s%s",
5454
common.Config.DownloadDomainURL.Scheme,
5555
common.Config.DownloadDomainURL.Host,
5656
req.RequestURI)
57+
log.Warningf("Invalid download domain %s, expected %s", req.Host, common.Config.DownloadDomainURL.Host)
5758
http.Redirect(resp, req, downloadURL, 301)
5859
return
5960
}

0 commit comments

Comments
 (0)