mirror of https://github.com/JustKato/FreePad.git
				
				
				
			Compare commits
	
		
			2 Commits
		
	
	
		
			ca10033ecf
			...
			3a6c796cac
		
	
	| Author | SHA1 | Date | 
|---|---|---|
| 
							
							
								
									
								
								 | 
						3a6c796cac | |
| 
							
							
								
									
								
								 | 
						6376fa9128 | 
							
								
								
									
										23
									
								
								README.md
								
								
								
								
							
							
						
						
									
										23
									
								
								README.md
								
								
								
								
							| 
						 | 
				
			
			@ -19,6 +19,29 @@ The project is absolutely free to use, you can extend the code and even contribu
 | 
			
		|||
 | 
			
		||||
The current maintainer and creator is `Kato Twofold`
 | 
			
		||||
 | 
			
		||||
# 🛑 About reverse proxying 🛑
 | 
			
		||||
If you are looking to reverse proxy this program, please keep in mind that the websockets have specific settings regarding reverse proxying, I have tried using `Apache2` but to no luck, if someone could give a suggestion as to how to set up my own program on `Apache2` it'd be amazing.
 | 
			
		||||
On `Nginx` it's rather simple, here is my reverse proxy for the demo at [pad.justkato.me](https://pad.justkato.me/)
 | 
			
		||||
```nginx
 | 
			
		||||
server {
 | 
			
		||||
    # Define the basic information such as server name and log location
 | 
			
		||||
    server_name     pad.justkato.me
 | 
			
		||||
    access_log      logs/pad.justkato.me.access.log main;
 | 
			
		||||
 | 
			
		||||
    # setup the reverse proxy
 | 
			
		||||
    location / {
 | 
			
		||||
        proxy_pass      http://127.0.0.1:1626;
 | 
			
		||||
        proxy_set_header X-Real-IP $remote_addr;
 | 
			
		||||
        proxy_set_header Host $host;
 | 
			
		||||
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 | 
			
		||||
 | 
			
		||||
        # WebSocket support !! Important !!
 | 
			
		||||
        proxy_http_version 1.1;
 | 
			
		||||
        proxy_set_header Upgrade $http_upgrade;
 | 
			
		||||
        proxy_set_header Connection "upgrade";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,7 +40,7 @@ func BindSocket(router *gin.RouterGroup) {
 | 
			
		|||
 | 
			
		||||
func webSocketUpgrade(ctx *gin.Context, padName string) {
 | 
			
		||||
 | 
			
		||||
	conn, err := wsUpgrader.Upgrade(ctx.Writer, ctx.Request, ctx.Request.Header)
 | 
			
		||||
	conn, err := wsUpgrader.Upgrade(ctx.Writer, ctx.Request, nil)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		fmt.Printf("Failed to set websocket upgrade: %v\n", err)
 | 
			
		||||
		return
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue