質問するログイン新規登録

質問編集履歴

2

修正

2016/09/23 11:13

投稿

bark_toro
bark_toro

スコア13

title CHANGED
File without changes
body CHANGED
@@ -3,11 +3,11 @@
3
3
 
4
4
  ```ここに言語を入力
5
5
  location /test/ {
6
- proxy_pass https://example.com/obj/;
6
+ proxy_pass https://******.com//****/****/;
7
7
  }
8
8
  ```
9
9
 
10
- https://example.com/obj/sample.jpg
10
+ https://example.com/test/sample.jpg
11
11
  と叩くと画像が表示されますが、
12
12
  これを強制ダウンロードさせるためヘッダの書き換えを行いたいと考えています。
13
13
 
@@ -17,7 +17,7 @@
17
17
  また、$file_nameの部分はPOSTの値を代入できるのが理想です。
18
18
 
19
19
  ```php
20
- $url = 'https://example.com/obj/sample.jpg';
20
+ $url = 'https://example.com/test/sample.jpg';
21
21
  $file_name = '画像.jpg';
22
22
 
23
23
  $header = get_headers($url, 1);

1

ミス修正

2016/09/23 11:13

投稿

bark_toro
bark_toro

スコア13

title CHANGED
File without changes
body CHANGED
@@ -3,7 +3,6 @@
3
3
 
4
4
  ```ここに言語を入力
5
5
  location /test/ {
6
- default_type application/octet-stream;
7
6
  proxy_pass https://example.com/obj/;
8
7
  }
9
8
  ```
@@ -12,13 +11,15 @@
12
11
  と叩くと画像が表示されますが、
13
12
  これを強制ダウンロードさせるためヘッダの書き換えを行いたいと考えています。
14
13
 
15
- PHPでいう下記のようなヘッに差し替えたいのですが、
14
+ PHPでいう下記のようなヘッに差し替えたいのですが、
16
15
  nginxの設定ファイルだけで対応できるものでしょうか。
17
16
 
18
17
  また、$file_nameの部分はPOSTの値を代入できるのが理想です。
19
18
 
20
19
  ```php
20
+ $url = 'https://example.com/obj/sample.jpg';
21
21
  $file_name = '画像.jpg';
22
+
22
23
  $header = get_headers($url, 1);
23
24
  header('Content-Type: application/octet-stream');
24
25
  header('Content-Length: '.$header['Content-Length']);