mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #2552 from erasche/gie-proxy-issue
More defensive GIE Proxying
This commit is contained in:
@@ -95,10 +95,15 @@ DynamicProxy.prototype.handleProxyRequest = function(req, res) {
|
||||
this.rewriteRequest(req);
|
||||
res.oldWriteHead = res.writeHead;
|
||||
res.writeHead = function(statusCode, headers) {
|
||||
|
||||
try {
|
||||
res.setHeader('Access-Control-Allow-Origin', origin);
|
||||
if(origin){
|
||||
res.setHeader('Access-Control-Allow-Origin', origin);
|
||||
}
|
||||
res.setHeader('Access-Control-Allow-Credentials', 'true');
|
||||
|
||||
if(!headers){
|
||||
headers = {};
|
||||
}
|
||||
res.oldWriteHead(statusCode, headers);
|
||||
}
|
||||
catch (error) {
|
||||
@@ -128,8 +133,11 @@ DynamicProxy.prototype.handleWs = function(req, res, head) {
|
||||
res.oldWriteHead = res.writeHead;
|
||||
res.writeHead = function(statusCode, headers) {
|
||||
try {
|
||||
res.setHeader('Access-Control-Allow-Origin', origin);
|
||||
if(origin){
|
||||
res.setHeader('Access-Control-Allow-Origin', origin);
|
||||
}
|
||||
res.setHeader('Access-Control-Allow-Credentials', 'true');
|
||||
if(!headers){ headers = {}; }
|
||||
res.oldWriteHead(statusCode, headers);
|
||||
}
|
||||
catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user