Skip to content

Commit 8858ce4

Browse files
committed
experiment: Add Nginx reverse proxy configuration (WIP - networking issues on macOS)
- Add nginx.experiment.conf with path rewriting - Add docker-compose.nginx-experiment.yml - Add test-nginx-experiment.sh test script - Note: Encountering Docker networking issues on macOS - host.docker.internal works from container - But port 8081 times out from host - Caddy experiment works perfectly as reference The configuration is correct but needs Linux Docker or different setup for macOS.
1 parent 30ab797 commit 8858ce4

File tree

5 files changed

+380
-118
lines changed

5 files changed

+380
-118
lines changed

URL_PATH_ANALYSIS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: '3.8'
2+
3+
services:
4+
nginx:
5+
image: nginx:alpine
6+
container_name: codimd-nginx-experiment
7+
ports:
8+
- "8081:8081"
9+
volumes:
10+
- ./nginx.experiment.conf:/etc/nginx/conf.d/default.conf:ro
11+
- nginx-logs:/var/log/nginx
12+
extra_hosts:
13+
# Allow Nginx to reach host's localhost where CodiMD is running
14+
- "host.docker.internal:host-gateway"
15+
restart: unless-stopped
16+
17+
volumes:
18+
nginx-logs:

locales/ja.json

Lines changed: 141 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,142 @@
11
{
2-
"Collaborative markdown notes": "共同編集できるMarkdownノート",
3-
"Realtime collaborative markdown notes on all platforms.": "マルチプラットフォーム、リアルタイムで共同編集できるMarkdownノート",
4-
"Best way to write and share your knowledge in markdown.": "Markdownでナレッジを蓄積・共有できるベストツール",
5-
"Intro": "サービスの紹介",
6-
"History": "履歴",
7-
"New guest note": "新規ゲストノート",
8-
"Collaborate with URL": "URLで共同編集",
9-
"Support charts and MathJax": "グラフとMathJaxのサポート",
10-
"Support slide mode": "スライドモードのサポート",
11-
"Sign In": "サインイン",
12-
"Below is the history from browser": "ブラウザからの履歴",
13-
"Welcome!": "ようこそ!",
14-
"New note": "新規ノート",
15-
"or": "または",
16-
"Sign Out": "サインアウト",
17-
"Explore all features": "すべての機能をチェック",
18-
"Select tags...": "タグで検索",
19-
"Search keyword...": "キーワードで検索",
20-
"Sort by title": "タイトル順でソート",
21-
"Title": "タイトル",
22-
"Sort by time": "日時順でソート",
23-
"Time": "日時",
24-
"Export history": "履歴をエクスポート",
25-
"Import history": "履歴をインポート",
26-
"Clear history": "履歴をクリア",
27-
"Refresh history": "履歴を更新",
28-
"No history": "履歴はありません",
29-
"Import from browser": "ブラウザからインポート",
30-
"Releases": "リリース",
31-
"Are you sure?": "本当にいいですか?",
32-
"Do you really want to delete this note?": "本当にこのノートを削除しますか?",
33-
"All users will lose their connection.": "すべてのユーザーの接続が切断されます。",
34-
"Cancel": "キャンセル",
35-
"Yes, do it!": "はい",
36-
"Choose method": "選択してください",
37-
"Sign in via %s": "%sでサインイン",
38-
"New": "新規作成",
39-
"Publish": "公開する",
40-
"Extra": "その他",
41-
"Revision": "編集履歴",
42-
"Slide Mode": "スライドモード",
43-
"Export": "エクスポート",
44-
"Import": "インポート",
45-
"Clipboard": "クリップボード",
46-
"Download": "ダウンロード",
47-
"Raw HTML": "HTMLパーツ",
48-
"Edit": "編集モード",
49-
"View": "表示モード",
50-
"Both": "分割モード",
51-
"Help": "ヘルプ",
52-
"Upload Image": "画像をアップロード",
53-
"Menu": "メニュー",
54-
"This page need refresh": "ページをリロードしてください",
55-
"You have an incompatible client version.": "クライアントのバージョンが一致しません",
56-
"Refresh to update.": "リロードして更新を反映させてください",
57-
"New version available!": "新しいバージョンが利用できます!",
58-
"See releases notes here": "リリースノートをご覧ください",
59-
"Refresh to enjoy new features.": "リロードして新しい機能を試してみましょう",
60-
"Your user state has changed.": "ユーザー情報が変更されました",
61-
"Refresh to load new user state.": "リロードすると最新のユーザー情報が反映されます",
62-
"Refresh": "リロード",
63-
"Contacts": "コンタクト",
64-
"Report an issue": "問題を報告する",
65-
"Meet us on %s": "%sでチャットする",
66-
"Send us email": "メールを送る",
67-
"Documents": "ドキュメント",
68-
"Features": "機能",
69-
"YAML Metadata": "YAMLメタデータ",
70-
"Slide Example": "スライドサンプル",
71-
"Cheatsheet": "チートシート",
72-
"Example": "",
73-
"Syntax": "構文",
74-
"Header": "見出し",
75-
"Unordered List": "番号なしリスト",
76-
"Ordered List": "番号付きリスト",
77-
"Todo List": "TODOリスト",
78-
"Blockquote": "引用文",
79-
"Bold font": "太字",
80-
"Italics font": "斜体",
81-
"Strikethrough": "打ち消し線",
82-
"Inserted text": "挿入文",
83-
"Marked text": "マーカー",
84-
"Link": "リンク",
85-
"Image": "画像",
86-
"Code": "コード",
87-
"Externals": "モジュール",
88-
"This is a alert area.": "これはアラートエリアです",
89-
"Revert": "戻す",
90-
"Import from clipboard": "クリップボードからインポート",
91-
"Paste your markdown or webpage here...": "Markdownまたはウェブページを貼り付けてください",
92-
"Clear": "クリア",
93-
"This note is locked": "このノートはロックされています",
94-
"Sorry, only owner can edit this note.": "このノートはオーナーのみが編集できます",
95-
"OK": "OK",
96-
"Reach the limit": "上限に達しました",
97-
"Sorry, you've reached the max length this note can be.": "ノートの文字数が上限に達しました。",
98-
"Please reduce the content or divide it to more notes, thank you!": "内容を減らすか、別のノートに分けてください",
99-
"Import from Gist": "gistからインポート",
100-
"Paste your gist url here...": "gistのURLを貼り付けてください",
101-
"Import from Snippet": "スニペットからインポート",
102-
"Select From Available Projects": "プロジェクトを一覧から選択してください",
103-
"Select From Available Snippets": "スニペットを一覧から選択してください",
104-
"OR": "または",
105-
"Export to Snippet": "スニペットにエクスポート",
106-
"Select Visibility Level": "公開範囲を選んでください",
107-
"Night Theme": "ナイトテーマ",
108-
"Follow us on %s and %s.": "%s と %s でフォローしてください。",
109-
"Privacy": "プライバシー",
110-
"Terms of Use": "利用条件",
111-
"Do you really want to delete your user account?": "本当にアカウントを削除しますか?",
112-
"This will delete your account, all notes that are owned by you and remove all references to your account from other notes.": "この操作はあなたのアカウントとあなたの所有するすべてのノートを削除し、さらに他の人のノートからあなたのアカウントへの参照を除去します。",
113-
"Delete user": "ユーザーの削除",
114-
"Export user data": "ユーザーデータをエクスポート",
115-
"Help us translating on %s": "%s の翻訳にご協力ください",
116-
"Source Code": "ソースコード",
117-
"Register": "登録",
118-
"Powered by %s": "Powered by %s"
119-
}
2+
"Collaborative markdown notes": "共同編集できるMarkdownノート",
3+
"Realtime collaborative markdown notes on all platforms.": "マルチプラットフォーム、リアルタイムで共同編集できるMarkdownノート",
4+
"Best way to write and share your knowledge in markdown.": "Markdownでナレッジを蓄積・共有できるベストツール",
5+
"Intro": "サービスの紹介",
6+
"History": "履歴",
7+
"New guest note": "新規ゲストノート",
8+
"Collaborate with URL": "URLで共同編集",
9+
"Support charts and MathJax": "グラフとMathJaxのサポート",
10+
"Support slide mode": "スライドモードのサポート",
11+
"Sign In": "サインイン",
12+
"Below is the history from browser": "ブラウザからの履歴",
13+
"Welcome!": "ようこそ!",
14+
"New note": "新規ノート",
15+
"or": "または",
16+
"Sign Out": "サインアウト",
17+
"Explore all features": "すべての機能をチェック",
18+
"Select tags...": "タグで検索",
19+
"Search keyword...": "キーワードで検索",
20+
"Sort by title": "タイトル順でソート",
21+
"Title": "タイトル",
22+
"Sort by time": "日時順でソート",
23+
"Time": "日時",
24+
"Export history": "履歴をエクスポート",
25+
"Import history": "履歴をインポート",
26+
"Clear history": "履歴をクリア",
27+
"Refresh history": "履歴を更新",
28+
"No history": "履歴はありません",
29+
"Import from browser": "ブラウザからインポート",
30+
"Releases": "リリース",
31+
"Are you sure?": "本当にいいですか?",
32+
"Do you really want to delete this note?": "本当にこのノートを削除しますか?",
33+
"All users will lose their connection.": "すべてのユーザーの接続が切断されます。",
34+
"Cancel": "キャンセル",
35+
"Yes, do it!": "はい",
36+
"Choose method": "選択してください",
37+
"Sign in via %s": "%sでサインイン",
38+
"New": "新規作成",
39+
"Publish": "公開する",
40+
"Extra": "その他",
41+
"Revision": "編集履歴",
42+
"Slide Mode": "スライドモード",
43+
"Export": "エクスポート",
44+
"Import": "インポート",
45+
"Clipboard": "クリップボード",
46+
"Download": "ダウンロード",
47+
"Raw HTML": "HTMLパーツ",
48+
"Edit": "編集モード",
49+
"View": "表示モード",
50+
"Both": "分割モード",
51+
"Help": "ヘルプ",
52+
"Upload Image": "画像をアップロード",
53+
"Menu": "メニュー",
54+
"This page need refresh": "ページをリロードしてください",
55+
"You have an incompatible client version.": "クライアントのバージョンが一致しません",
56+
"Refresh to update.": "リロードして更新を反映させてください",
57+
"New version available!": "新しいバージョンが利用できます!",
58+
"See releases notes here": "リリースノートをご覧ください",
59+
"Refresh to enjoy new features.": "リロードして新しい機能を試してみましょう",
60+
"Your user state has changed.": "ユーザー情報が変更されました",
61+
"Refresh to load new user state.": "リロードすると最新のユーザー情報が反映されます",
62+
"Refresh": "リロード",
63+
"Contacts": "コンタクト",
64+
"Report an issue": "問題を報告する",
65+
"Meet us on %s": "%sでチャットする",
66+
"Send us email": "メールを送る",
67+
"Documents": "ドキュメント",
68+
"Features": "機能",
69+
"YAML Metadata": "YAMLメタデータ",
70+
"Slide Example": "スライドサンプル",
71+
"Cheatsheet": "チートシート",
72+
"Example": "",
73+
"Syntax": "構文",
74+
"Header": "見出し",
75+
"Unordered List": "番号なしリスト",
76+
"Ordered List": "番号付きリスト",
77+
"Todo List": "TODOリスト",
78+
"Blockquote": "引用文",
79+
"Bold font": "太字",
80+
"Italics font": "斜体",
81+
"Strikethrough": "打ち消し線",
82+
"Inserted text": "挿入文",
83+
"Marked text": "マーカー",
84+
"Link": "リンク",
85+
"Image": "画像",
86+
"Code": "コード",
87+
"Externals": "モジュール",
88+
"This is a alert area.": "これはアラートエリアです",
89+
"Revert": "戻す",
90+
"Import from clipboard": "クリップボードからインポート",
91+
"Paste your markdown or webpage here...": "Markdownまたはウェブページを貼り付けてください",
92+
"Clear": "クリア",
93+
"This note is locked": "このノートはロックされています",
94+
"Sorry, only owner can edit this note.": "このノートはオーナーのみが編集できます",
95+
"OK": "OK",
96+
"Reach the limit": "上限に達しました",
97+
"Sorry, you've reached the max length this note can be.": "ノートの文字数が上限に達しました。",
98+
"Please reduce the content or divide it to more notes, thank you!": "内容を減らすか、別のノートに分けてください",
99+
"Import from Gist": "gistからインポート",
100+
"Paste your gist url here...": "gistのURLを貼り付けてください",
101+
"Import from Snippet": "スニペットからインポート",
102+
"Select From Available Projects": "プロジェクトを一覧から選択してください",
103+
"Select From Available Snippets": "スニペットを一覧から選択してください",
104+
"OR": "または",
105+
"Export to Snippet": "スニペットにエクスポート",
106+
"Select Visibility Level": "公開範囲を選んでください",
107+
"Night Theme": "ナイトテーマ",
108+
"Follow us on %s and %s.": "%s と %s でフォローしてください。",
109+
"Privacy": "プライバシー",
110+
"Terms of Use": "利用条件",
111+
"Do you really want to delete your user account?": "本当にアカウントを削除しますか?",
112+
"This will delete your account, all notes that are owned by you and remove all references to your account from other notes.": "この操作はあなたのアカウントとあなたの所有するすべてのノートを削除し、さらに他の人のノートからあなたのアカウントへの参照を除去します。",
113+
"Delete user": "ユーザーの削除",
114+
"Export user data": "ユーザーデータをエクスポート",
115+
"Help us translating on %s": "%s の翻訳にご協力ください",
116+
"Source Code": "ソースコード",
117+
"Register": "登録",
118+
"Powered by %s": "Powered by %s",
119+
"CONNECTED": "CONNECTED",
120+
"ONLINE": "ONLINE",
121+
"OFFLINE": "OFFLINE",
122+
"Anyone can edit": "Anyone can edit",
123+
"Freely": "Freely",
124+
"Signed-in people can edit": "Signed-in people can edit",
125+
"Editable": "Editable",
126+
"Signed-in people can edit (forbid guests)": "Signed-in people can edit (forbid guests)",
127+
"Limited": "Limited",
128+
"Only owner can edit": "Only owner can edit",
129+
"Locked": "Locked",
130+
"Only owner can edit (forbid guests)": "Only owner can edit (forbid guests)",
131+
"Protected": "Protected",
132+
"Only owner can view & edit": "Only owner can view & edit",
133+
"Private": "Private",
134+
"Delete this note": "Delete this note",
135+
"owned this note": "owned this note",
136+
"Expand all": "Expand all",
137+
"Collapse all": "Collapse all",
138+
"Back to top": "Back to top",
139+
"Go to bottom": "Go to bottom",
140+
"Export with pandoc": "Export with pandoc",
141+
"Select output format": "Select output format"
142+
}

nginx.experiment.conf

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Nginx configuration for CodiMD with path rewriting experiment
2+
# This config strips the /codimd prefix before forwarding to the app
3+
4+
server {
5+
listen 8081;
6+
server_name localhost;
7+
8+
# Enable detailed logging
9+
access_log /var/log/nginx/codimd-access.log combined;
10+
error_log /var/log/nginx/codimd-error.log debug;
11+
12+
# 1. Redirect root to /codimd/
13+
location = / {
14+
return 301 /codimd/;
15+
}
16+
17+
# 2. Redirect /codimd (without trailing slash) to /codimd/
18+
location = /codimd {
19+
return 301 /codimd/;
20+
}
21+
22+
# 3. Handle Socket.IO with path stripping
23+
location ~ ^/codimd/socket\.io/ {
24+
# Strip /codimd prefix
25+
rewrite ^/codimd/(.*)$ /$1 break;
26+
27+
# Proxy to CodiMD
28+
proxy_pass http://host.docker.internal:3000;
29+
30+
# WebSocket support
31+
proxy_http_version 1.1;
32+
proxy_set_header Upgrade $http_upgrade;
33+
proxy_set_header Connection "upgrade";
34+
35+
# Standard proxy headers
36+
proxy_set_header Host $host;
37+
proxy_set_header X-Real-IP $remote_addr;
38+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
39+
proxy_set_header X-Forwarded-Proto $scheme;
40+
proxy_set_header X-Forwarded-Host $host;
41+
proxy_set_header X-Forwarded-Prefix /codimd;
42+
43+
# Timeouts for WebSocket
44+
proxy_read_timeout 86400;
45+
proxy_send_timeout 86400;
46+
}
47+
48+
# 4. Handle all other /codimd/* requests
49+
location /codimd/ {
50+
# Strip /codimd prefix before forwarding
51+
rewrite ^/codimd/(.*)$ /$1 break;
52+
53+
# Proxy to CodiMD running at root
54+
proxy_pass http://host.docker.internal:3000;
55+
56+
# Standard proxy headers
57+
proxy_set_header Host $host;
58+
proxy_set_header X-Real-IP $remote_addr;
59+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
60+
proxy_set_header X-Forwarded-Proto $scheme;
61+
proxy_set_header X-Forwarded-Host $host;
62+
proxy_set_header X-Forwarded-Prefix /codimd;
63+
64+
# WebSocket support (for any upgrade requests)
65+
proxy_http_version 1.1;
66+
proxy_set_header Upgrade $http_upgrade;
67+
proxy_set_header Connection $connection_upgrade;
68+
}
69+
}
70+
71+
# Map for WebSocket connection upgrade
72+
map $http_upgrade $connection_upgrade {
73+
default upgrade;
74+
'' close;
75+
}

0 commit comments

Comments
 (0)