Skip to content

location header rewriting for HTTP 303 #1125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,9 @@ proxyServer.listen(8015);
* **changeOrigin**: true/false, Default: false - changes the origin of the host header to the target URL
* **preserveHeaderKeyCase**: true/false, Default: false - specify whether you want to keep letter case of response header key
* **auth**: Basic authentication i.e. 'user:password' to compute an Authorization header.
* **hostRewrite**: rewrites the location hostname on (201/301/302/307/308) redirects.
* **autoRewrite**: rewrites the location host/port on (201/301/302/307/308) redirects based on requested host/port. Default: false.
* **protocolRewrite**: rewrites the location protocol on (201/301/302/307/308) redirects to 'http' or 'https'. Default: null.
* **hostRewrite**: rewrites the location hostname on (201/301/302/303/307/308) redirects.
* **autoRewrite**: rewrites the location host/port on (201/301/302/303/307/308) redirects based on requested host/port. Default: false.
* **protocolRewrite**: rewrites the location protocol on (201/301/302/303/307/308) redirects to 'http' or 'https'. Default: null.
* **cookieDomainRewrite**: rewrites domain of `set-cookie` headers. Possible values:
* `false` (default): disable cookie rewriting
* String: new domain, for example `cookieDomainRewrite: "new.domain"`. To remove the domain, use `cookieDomainRewrite: ""`.
Expand Down
2 changes: 1 addition & 1 deletion lib/http-proxy/passes/web-outgoing.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var url = require('url'),
common = require('../common');


var redirectRegex = /^201|30(1|2|7|8)$/;
var redirectRegex = /^201|30(1|2|3|7|8)$/;

/*!
* Array of passes.
Expand Down
6 changes: 3 additions & 3 deletions test/lib-http-proxy-passes-web-outgoing-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('lib/http-proxy/passes/web-outgoing.js', function () {
beforeEach(function() {
this.options.hostRewrite = 'ext-manual.com';
});
[201, 301, 302, 307, 308].forEach(function(code) {
[201, 301, 302, 303, 307, 308].forEach(function(code) {
it('on ' + code, function() {
this.proxyRes.statusCode = code;
httpProxy.setRedirectHostRewrite(this.req, {}, this.proxyRes, this.options);
Expand Down Expand Up @@ -69,7 +69,7 @@ describe('lib/http-proxy/passes/web-outgoing.js', function () {
beforeEach(function() {
this.options.autoRewrite = true;
});
[201, 301, 302, 307, 308].forEach(function(code) {
[201, 301, 302, 303, 307, 308].forEach(function(code) {
it('on ' + code, function() {
this.proxyRes.statusCode = code;
httpProxy.setRedirectHostRewrite(this.req, {}, this.proxyRes, this.options);
Expand Down Expand Up @@ -108,7 +108,7 @@ describe('lib/http-proxy/passes/web-outgoing.js', function () {
beforeEach(function() {
this.options.protocolRewrite = 'https';
});
[201, 301, 302, 307, 308].forEach(function(code) {
[201, 301, 302, 303, 307, 308].forEach(function(code) {
it('on ' + code, function() {
this.proxyRes.statusCode = code;
httpProxy.setRedirectHostRewrite(this.req, {}, this.proxyRes, this.options);
Expand Down