Skip to content

Commit 7e4ddfb

Browse files
committed
Replaced 'url_for()' function with calculated 'proxy_path' value instead; allows correct URL generation when server is behind NGINX server and accessed via Ingress or LoadBalancer, and when server is standalone
1 parent 0b76e25 commit 7e4ddfb

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

src/murfey/templates/activevisits.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<html>
22
<head>
3-
<title>{{ microscope }}</title>
4-
<link href="{{ url_for('static', path='/styles.css') }}" rel="stylesheet" />
3+
<title>Visits {{ "({})".format(microscope) if microscope else "" }}</title>
4+
<link href="{{ proxy_path }}/static/styles.css" rel="stylesheet" />
55
<link
6-
href="{{ url_for('images', path='/icon_268.png') }}"
6+
href="{{ proxy_path }}/images/icon_268.png"
77
rel="icon"
88
type="image/png"
99
/>

src/murfey/templates/base.html

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
11
<html>
22
<head>
33
<title>Murfey - {% block title %}{% endblock %}</title>
4+
<link href="{{ proxy_path }}/static/styles.css" rel="stylesheet" />
45
<link
5-
href="{{ proxy_path }}{{ url_for('static', path='/styles.css') }}"
6-
rel="stylesheet"
7-
/>
8-
<link
9-
href="{{ proxy_path }}{{ url_for('images', path='/icon_268.png') }}"
6+
href="{{ proxy_path }}/images/icon_268.png"
107
rel="icon"
118
type="image/png"
129
/>
1310
</head>
1411
<body>
1512
<div class="topnav">
1613
<a href="{{ proxy_path }}/docs">Home</a>
17-
<a href="{{ proxy_path }}/bootstrap">Installation Instructions</a>
18-
<a href="{{ proxy_path }}/pypi/fastapi">FastAPI (PyPI)</a>
14+
<a href="{{ proxy_path }}/bootstrap/">Installation Instructions</a>
15+
<a href="{{ proxy_path }}/pypi/fastapi/">FastAPI (PyPI)</a>
1916
<p style="text-align: right; margin: 8px 10px 0 auto">
20-
<img
21-
src="{{ proxy_path }}{{ url_for('images', path='/diamond.png') }}"
22-
style="height: 25px"
23-
/>
17+
<img src="{{ proxy_path }}/images/diamond.png" style="height: 25px" />
2418
</p>
2519
</div>
2620

@@ -31,7 +25,8 @@
3125
For help please contact your local contact or the EM Data Analysis team.
3226
</p>
3327
<p style="font-size: 60%">
34-
Murfey v{{ version }} running on {{ hostname }} ({{ microscope }})
28+
Murfey v{{ version }} running on {{ hostname }} {{
29+
"({})".format(microscope) if microscope else "" }}
3530
</p>
3631
</div>
3732
</body>

0 commit comments

Comments
 (0)