mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-11-04 08:21:11 +00:00 
			
		
		
		
	[BRANDING] add X-Forgejo-* headers
(cherry picked from commit0a3388f93f) (cherry picked from commit7eba0a440a) (cherry picked from commiteb9646c7ef) (cherry picked from commitf1972578f5) Conflicts: (cherry picked from commit3d72f6b3ac) (cherry picked from commit6a94f830c0) (cherry picked from commit522a09dbc1) (cherry picked from commit471ad9f728)
This commit is contained in:
		
					parent
					
						
							
								57709acf65
							
						
					
				
			
			
				commit
				
					
						a27221e653
					
				
			
		
					 6 changed files with 25 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -32,6 +32,7 @@ func SetCacheControlInHeader(h http.Header, maxAge time.Duration, additionalDire
 | 
			
		|||
 | 
			
		||||
		// to remind users they are using non-prod setting.
 | 
			
		||||
		h.Set("X-Gitea-Debug", "RUN_MODE="+setting.RunMode)
 | 
			
		||||
		h.Set("X-Forgejo-Debug", "RUN_MODE="+setting.RunMode)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	h.Set("Cache-Control", strings.Join(append(directives, additionalDirectives...), ", "))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,6 +29,9 @@ func countFormalHeaders(h http.Header) (c int) {
 | 
			
		|||
		if strings.HasPrefix(k, "X-Gitea-") {
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
		if strings.HasPrefix(k, "X-Forgejo-") {
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
		c++
 | 
			
		||||
	}
 | 
			
		||||
	return c
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue