Http-proxy-middleware: FR: Add a option to allow change Referer header

Created on 18 Oct 2017  路  8Comments  路  Source: chimurai/http-proxy-middleware

Expected behavior

change the Referer header or give a option to do this

Actual behavior

Directly passed.

Setup

See https://github.com/webpack/webpack-dev-server/issues/1151

Most helpful comment

So what are we supposed to do if our backend enforces referer check??

All 8 comments

Try using the headers option to supply your own referer header.
As documented in https://github.com/chimurai/http-proxy-middleware#http-proxy-options

Oh I just think headers option is that from server to client...
We need change the header like way of changeOrigin option, tell me if I got something wrong

headers option is to change the headers between client to server.

referer can be basically any url. Not sure how you want to change that similar to changeOrigin.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer

Perhaps you can explain your use case a bit?

I've read that. Maybe I'm just not clear about what I am doing...

I got a js file, and use it in this way:

...
script.src = 'http://example/a/b/test.js'
...

And how am I supposed to write the proxy to change its referer.

@SidKwok were you ever able to solve that? I'm having the exact same issue.

@joaocraveriro it can鈥檛 be solved. It is a http request, webpack can鈥檛 proxy a http request. You can try to change headers via chrome extensions

So what are we supposed to do if our backend enforces referer check??

Was this page helpful?
0 / 5 - 0 ratings

Related issues

villesau picture villesau  路  8Comments

minhduchcm picture minhduchcm  路  7Comments

lukaszpochrzest picture lukaszpochrzest  路  3Comments

georgyfarniev picture georgyfarniev  路  7Comments

mshindal picture mshindal  路  4Comments