update uri matching, set header
This commit is contained in:
		
							parent
							
								
									7159151352
								
							
						
					
					
						commit
						71819be266
					
				| @ -174,6 +174,8 @@ module.exports.create = function (app, xconfx, apiFactories, apiDeps) { | ||||
|     var appIdParts = appId.split('#'); | ||||
|     var appIdPart; | ||||
| 
 | ||||
|     res.setHeader('X-Walnut-Uri', appId.replace(/#/g, '/')); | ||||
| 
 | ||||
|     // TODO configuration for allowing www
 | ||||
|     if (/^www\./.test(req.hostname)) { | ||||
|       // NOTE: acme responder and appcache unbricker must come before scrubTheDub
 | ||||
| @ -246,9 +248,8 @@ module.exports.create = function (app, xconfx, apiFactories, apiDeps) { | ||||
|     } | ||||
| 
 | ||||
|     console.log('[serveStaticHelper] appIdPart', appIdPart); | ||||
|     if (opts && opts.rewrite && -1 !== req.url.indexOf(appIdPart.replace(/#/, '/').replace(/\/$/, ''))) { | ||||
|       console.log('[staticHelper ReWrite]', req.url.slice(req.url.indexOf(appIdPart.replace(/#/, '/').replace(/\/$/, '')) + appIdPart.replace(/\/$/, '').length)); | ||||
|       req.url = req.url.slice(req.url.indexOf(appIdPart.replace(/#/, '/').replace(/\/$/, '')) + appIdPart.replace(/\/$/, '').length); | ||||
|     if (opts && opts.rewrite && -1 !== req.url.indexOf(appIdPart.replace(/#/g, '/').replace(/\/$/, ''))) { | ||||
|       req.url = req.url.slice(req.url.indexOf(appIdPart.replace(/#/g, '/').replace(/\/$/, '')) + appIdPart.replace(/(\/|#)$/, '').length); | ||||
|       if (0 !== req.url.indexOf('/')) { | ||||
|         req.url = '/' + req.url; | ||||
|       } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user