Skip to content

Add support of 303 to hostRewrite option #845

@abanctelchevrel

Description

@abanctelchevrel

My backend implements a POST to http://api.domain.com/resources with the following response :

  • Status Code : 303 See Other
  • Location header : http://api.domain.com/resources/resourceId

I use node-http-proxy (through grunt-proxy) to bypass SOP on my single page app (hosted on localhost:9000), but when I POST on /resources I keep having rejected request because of SOP, even using the hostRewrite option as follows :

httpProxy.createProxyServer({
                ...
                hostRewrite: 'localhost:9000'
              })

Digging into node-http-proxy code I found this test on response code in setRedirectHostRewrite precondition :

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

Why not add 303 to this condition ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions