1212
1313 < head >
1414 < meta charset =utf-8 >
15-
15+
1616 < title >
1717 Very Simple Proxy
1818 </ title >
19-
19+
2020 < meta name =description content ='Learn how to build a simple Node.js proxy server that forwards HTTP requests. Explore editable, runnable code via web containers to inspect headers and relay responses seamlessly. '>
2121 < link rel =icon type ='image/png ' href ='/blog/image/blog-30.png '>
2222 < meta name =viewport content ='width=device-width, initial-scale=1 '>
23-
23+
2424 < base href ='https://ext-code.com/blog/25-07-26/very-simple-http-proxy/ '>
2525 < link rel =canonical href ='https://ext-code.com/blog/25-07-26/very-simple-http-proxy/very-simple-http-proxy.html '>
2626
27-
27+
2828 < script type ='application/ld+json '>
2929
3030 {
3838 "mainEntityOfPage" : { "@type" :"WebPage" , "@id" :"https://ext-code.com/blog/25-07-25/http-streaming-download/http-streaming-download.html" } ,
3939 "publisher" : { "@type" :"Organization" , "name" :"ext-code.com" , "logo" :{ "@type" :"ImageObject" , "url" :"https://ext-code.com/favicon.ico" } } ,
4040 }
41-
41+
4242 </ script >
43-
44-
45-
43+
44+
45+
4646 < script src ='https://ajaxorg.github.io/ace-builds/src-noconflict/ace.js '> </ script >
47-
48-
49- < script src ='https://libs.ext-code.com/js/dom/component/component.js '> </ script >
5047
51-
52- < script init >
48+
49+ < script src ='https://libs.ext-code.com/js/dom/component/v3.0/component.js '> </ script >
50+
51+
52+ < script init >
5353 console . clear ( ) ;
5454 console . log ( 'very-simple-http-proxy.html' ) ;
5555 console . log ( ) ;
5656 console . json = v => console . log ( JSON . stringify ( v , null , 4 ) ) ;
5757 var df = true , version = 'v2.0'
5858 ;
59-
60-
59+
60+
6161 var ace ;
6262
6363 var ext ;
6666 var menumod ;
6767 var keydown ;
6868 var debug ;
69-
69+
7070 var menu ;
71-
71+
7272 var hdr ;
7373 var example ;
7474 var log ;
7575
7676
7777 //:
78-
79-
78+
79+
8080 async function init ( ) {
8181 //debug('init',version);
82-
82+
8383 menu = menumod ( ) ;
84-
84+
8585 mod . base . add ( { ext, $, datatype, keydown, menu, menumod, ace} ) ;
8686
87-
87+
8888 hdr = mod [ 'blog-hdr' ] ;
8989 example = mod . example ;
9090 log = mod [ 'log-mod' ] ;
100100 example . init ( ) ,
101101 log . init ( ) ,
102102 ] ) ;
103-
104-
105-
103+
104+
105+
106106 initdom ( document . body ) ;
107-
107+
108108
109109 } //init
110-
111-
110+
111+
112112 //:
113113
114114
117117 mod . stack . add ;
118118
119119 ( { ext} = await import ( 'https://libs.ext-code.com/js/io/ext-loader/ext-loader.m.js' ) ) ;
120-
120+
121121 var promise = ext . load . libs (
122122 'js/dom/$.js.api' ,
123123 'js/core/datatype.js' ,
126126 'js/debug/debug.js' ,
127127 ) ;
128128 [ $ , datatype , menumod , keydown , debug ] = await promise ;
129-
129+
130130
131131 [ srcdoc ] = await ext . text . github ( 'javascript-2020:javascript-2020.github.io:main:blog/25-07-25/http-streaming-download/ex/srcdoc.html' ) ;
132132
133133 mod . stack . complete ;
134-
134+
135135} ) ( ) ;
136136
137-
138- </ script init>
139-
140137
138+ </ script init>
139+
140+
141141<!--
142142 //:
143143-->
144144
145-
146- < link rel =stylesheet href ='/blog/css/blog.css '>
147145
146+ < link rel =stylesheet href ='/blog/css/blog.css '>
147+
148148 < style >
149149
150150 html
159159 [component ]
160160 {display : none}
161161
162- .description
162+ .description
163163 {max-width : 1000px ;text-align : justify;border-left : 4px solid # 4a90e2 ;padding : 1rem ;
164164 background-color : # f9f9f9 ;font-family : system-ui, sans-serif;font-size : 1rem ;line-height : 1.6 ;color : # 333 }
165165 .description > p
166166 {margin : 0 }
167167 .description > p + p
168168 {margin : 10px 0 }
169-
169+
170170 code
171171 {font-family : monospace;background : whitesmoke}
172172 code .inline
173173 {display : inline;padding : 5px 10px }
174-
174+
175175 a
176176 {color : # 4a90e2 ;text-decoration : none;font-weight : 500 }
177- a : hover
177+ a : hover
178178 {text-decoration : underline}
179179 .link-domain
180180 {font-size : 0.85rem ;color : # 777 ;margin-left : 0.25rem }
181- .link-domain ::before
181+ .link-domain ::before
182182 {content : '[' }
183183 .link-domain ::after
184184 {content : ']' }
185185 .link-txt
186186 {}
187-
187+
188188 input
189189 {font-size : 16px ;padding : 5px 7px ;box-sizing : border-box;}
190190 input [type = button ]
191191 {cursor : pointer}
192-
193-
194-
195-
192+
193+
194+
195+
196196
197197 iframe
198198 {width : 100% }
199-
200-
201-
199+
200+
201+
202202 </ style >
203203
204204 </ head >
205205
206206
207207 < body >
208-
209-
208+
209+
210210 < blog-hdr component =grp1 >
211211 < h1 class =title >
212212 Very Simple Proxy
@@ -215,15 +215,15 @@ <h1 class=title>
215215 22 Oct 2025
216216 </ time >
217217 </ blog-hdr >
218-
219-
218+
219+
220220 < div class =description >
221221
222222 < p >
223223 Learn how to build a simple Node.js proxy server that forwards HTTP requests.
224224 Explore editable, runnable code via web containers to inspect headers and relay responses seamlessly.
225225 </ p >
226-
226+
227227 < p >
228228 notes:
229229 </ p >
@@ -244,7 +244,7 @@ <h1 class=title>
244244 </ span >
245245 </ a >
246246 </ p >
247-
247+
248248 < p >
249249 < a href ='https://nodejs.org/api/http.html#httprequesturl-options-callback ' class =link-stable >
250250 http.request
@@ -262,7 +262,7 @@ <h1 class=title>
262262 </ span >
263263 </ a >
264264 </ p >
265-
265+
266266 < p >
267267 </ p >
268268
@@ -276,7 +276,7 @@ <h1 class=title>
276276 </ p >
277277
278278 < p >
279- a working version of the nodejs https proxy server will be available
279+ a working version of the nodejs https proxy server will be available
280280 < a href ='/code/nodejs/servers/very-simple-proxy.nodejs.js '>
281281 /code/nodejs/servers/very-simple-proxy.nodejs.js
282282 < span class =link-domain >
@@ -289,37 +289,37 @@ <h1 class=title>
289289
290290
291291
292-
292+
293293 < snippet-terminal-console id =example type =nodejs src ='ex/very-simple-http-proxy.js ' component > </ snippet-terminal-console >
294-
295-
294+
295+
296296 < iframe id =iframe > </ iframe >
297-
298-
297+
298+
299299 < log-mod component > </ log-mod >
300-
301-
300+
301+
302302 </ body >
303-
304-
303+
304+
305305 < script >
306-
306+
307307
308308 var webcontainer ;
309309 var process ;
310-
310+
311311 var urls = { } ;
312312
313313
314314 var btn = { } ;
315315 var on = { } ;
316316
317-
317+
318318 //:
319319
320320
321321 function initdom ( rootnode ) {
322-
322+
323323 hdr . initdom ( ) ;
324324
325325 example . initdom ( ) ;
@@ -329,13 +329,13 @@ <h1 class=title>
329329
330330
331331 } //initdom
332-
333-
332+
333+
334334 //:
335-
336-
335+
336+
337337 btn . run = async function ( ) {
338-
338+
339339 if ( process ) {
340340 await process . kill ( ) ;
341341 }
@@ -344,9 +344,9 @@ <h1 class=title>
344344
345345 } //run
346346
347-
347+
348348 on . init = function ( { webcontainer :wc } ) {
349-
349+
350350 webcontainer = wc ;
351351
352352 } //init
@@ -366,9 +366,9 @@ <h1 class=title>
366366 }
367367
368368 } //server-ready
369-
370-
371-
369+
370+
371+
372372 </ script >
373373
374374</ html >
0 commit comments