Skip to content

Commit b4481da

Browse files
committed
Serve static data from a separate domain.
Fix #73
1 parent 467dc4f commit b4481da

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

src/main/config/nginx/mystamps-ssl.conf

+8
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ server {
2020
try_files /503.$lang.html =502;
2121
}
2222

23+
location /image/ {
24+
return 301 https://stamps.filezz.ru$request_uri;
25+
}
26+
27+
location ~* \.(ico|css|js)$ {
28+
return 301 https://stamps.filezz.ru$request_uri;
29+
}
30+
2331
location / {
2432
error_page 502 =503 @maintenance;
2533
proxy_set_header X-Forwarded-For $remote_addr;
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
server {
2+
listen 443;
3+
server_name stamps.filezz.ru;
4+
server_tokens off;
5+
error_log /data/logs/nginx-static.log notice;
6+
proxy_buffers 128 4k;
7+
8+
ssl on;
9+
ssl_certificate /etc/ssl/my-stamps.ru.crt;
10+
ssl_certificate_key /etc/ssl/my-stamps.ru.key;
11+
12+
location / {
13+
return 301 https://my-stamps.ru;
14+
}
15+
16+
location /image/ {
17+
proxy_set_header X-Forwarded-For $remote_addr;
18+
proxy_pass http://127.0.0.1:8080;
19+
}
20+
21+
location ~* \.(ico|css|js)$ {
22+
proxy_set_header X-Forwarded-For $remote_addr;
23+
proxy_pass http://127.0.0.1:8080;
24+
}
25+
26+
}

src/main/java/ru/mystamps/web/Url.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
*/
3030
public final class Url {
3131
public static final String PUBLIC_URL = "https://my-stamps.ru";
32-
public static final String STATIC_RESOURCES_URL = PUBLIC_URL;
32+
public static final String STATIC_RESOURCES_URL = "https://stamps.filezz.ru";
3333

3434
// defined at pom.xml (and used by functional tests only)
3535
public static final String SITE = "http://127.0.0.1:8080";

vagrant/provisioning/roles/mystamps-nginx/tasks/main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
with_items:
2828
- mystamps-http.conf
2929
- mystamps-ssl.conf
30+
- mystamps-static.conf
3031
notify:
3132
- Restarting nginx service
3233

0 commit comments

Comments
 (0)