Last active
April 19, 2023 11:06
-
-
Save ethinx/fd20b5c8a0e63a5ba0a5a4527c8a0e32 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pipy({ | |
| _file: null | |
| }) | |
| .listen(1080) | |
| .demuxHTTP().to('proxy') | |
| .pipeline('proxy') | |
| .muxHTTP().to( | |
| $=>$.connect(()=>'192.168.66.147:8080') | |
| ) | |
| .listen(2080) | |
| .demuxHTTP().to('inbound') | |
| .pipeline('inbound') | |
| .replaceMessage( | |
| msg=>( | |
| msg = http.File.from('static/index.html').toMessage(msg.head.headers['accept-encoding']) | |
| ) | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| events {} | |
| daemon off; | |
| worker_processes 1; | |
| http { | |
| error_log /data/nginx/logs/error.log ; | |
| access_log /data/nginx/logs/access.log; | |
| #include /data/nginx/config.d/*.conf ; | |
| # | |
| upstream backend { | |
| server 192.168.66.147:8080; | |
| keepalive 200; | |
| } | |
| server { | |
| listen 1081; | |
| server_name _; | |
| access_log off; | |
| location / { | |
| proxy_set_header Connection ""; | |
| proxy_http_version 1.1; | |
| proxy_pass http://backend/; | |
| } | |
| } | |
| server { | |
| listen 2081; | |
| server_name web2.flomesh.lab; | |
| access_log off; | |
| location / { | |
| root /data/gateway/static; | |
| index index.html; | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pipy() | |
| .listen(8080) | |
| .serveHTTP( | |
| ()=> new Message(`<!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Hi, Pipy!</title> | |
| </head> | |
| <body> | |
| <h1>Hi, Pipy!</h1> | |
| <p>This is a web page served from web2.</p> | |
| </body> | |
| </html> | |
| `) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment