mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-03 21:08:25 +00:00 
			
		
		
		
	Revert "If httpsig verification fails, fix Host header and try again"
This reverts commit f53e46c721.
The bug was actually caused by nginx messing up the Host header when reverse-proxying since I didn't have the line `proxy_set_header Host $host;` in my nginx config for Gitea.
			
			
This commit is contained in:
		@@ -90,16 +90,6 @@ func verifyHTTPSignatures(ctx *gitea_context.APIContext) (authenticated bool, er
 | 
				
			|||||||
	// 3. Verify the other actor's key
 | 
						// 3. Verify the other actor's key
 | 
				
			||||||
	algo := httpsig.Algorithm(setting.Federation.Algorithms[0])
 | 
						algo := httpsig.Algorithm(setting.Federation.Algorithms[0])
 | 
				
			||||||
	authenticated = v.Verify(pubKey, algo) == nil
 | 
						authenticated = v.Verify(pubKey, algo) == nil
 | 
				
			||||||
	if authenticated {
 | 
					 | 
				
			||||||
		return
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	// 4. When Gitea and the other ActivityPub server are running on the same machine, the Host header is sometimes incorrect
 | 
					 | 
				
			||||||
	r.Header["Host"] = []string{setting.Domain}
 | 
					 | 
				
			||||||
	v, err = httpsig.NewVerifier(r)
 | 
					 | 
				
			||||||
	if err != nil {
 | 
					 | 
				
			||||||
		return
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	authenticated = v.Verify(pubKey, algo) == nil
 | 
					 | 
				
			||||||
	return
 | 
						return
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user