Skip to content

Commit

Permalink
v1.2.61
Browse files Browse the repository at this point in the history
  • Loading branch information
binary-person committed Dec 21, 2022
1 parent d898ab8 commit 73f6ad2
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v1.2.61

- fix missing cors origin header when port and crossDomainPort are the same

## v1.2.6

- properly fixed window.top issues when window.top isn't hammerhead
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rammerhead",
"version": "1.2.6",
"version": "1.2.61",
"description": "User friendly web proxy powered by testcafe-hammerhead",
"main": "src/index.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions src/classes/RammerheadProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const RammerheadLogging = require('../classes/RammerheadLogging');
const RammerheadJSMemCache = require('./RammerheadJSMemCache.js');

require('../util/fixCorsHeader');
require('../util/fixCorsMissingOriginHeader.js');
require('../util/fixWebsocket');
require('../util/addMoreErrorGuards');
require('../util/addUrlShuffling');
Expand Down
12 changes: 12 additions & 0 deletions src/util/fixCorsMissingOriginHeader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const transforms = require('testcafe-hammerhead/lib/request-pipeline/header-transforms/transforms');
const BUILTIN_HEADERS = require('testcafe-hammerhead/lib/request-pipeline/builtin-header-names');

/**
* if we create this server with port === crossDomainPort, origin header doesn't get properly sent
* so we manually add it if reqOrigin !== url
*/

transforms.forcedRequestTransforms[BUILTIN_HEADERS.origin] = (_src, ctx) => {
if (ctx.serverInfo.port != ctx.serverInfo.crossDomainPort) return void 0;
return ctx.dest.reqOrigin || ctx.dest.domain;
};

0 comments on commit 73f6ad2

Please sign in to comment.