Skip to content
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

Feature suggestion: Proxying a request may want to change the Host header #1729

Closed
Volune opened this issue Nov 28, 2015 · 1 comment · May be fixed by saurabharch/HireDot2#2, saurabharch/Breezeblocks#2 or saurabharch/reelcool#1

Comments

@Volune
Copy link
Contributor

Volune commented Nov 28, 2015

I have a case where I need karma to proxy requests with a specific Host header (matching the target configuration).

The http-proxy module, used by karma, has an option to do so: changeOrigin. I would like to be able to enable this option in the configuration file, per proxy.

I have a suggestion of solution ready at this branch
Example of configuration in config file:

proxies: {
        '/foo': 'http://foo.localhost',
        '/bar': {
            target: 'http://bar.localhost',
            changeOrigin: true
        }
    }

Thanks

@dignifiedquire
Copy link
Member

I think as we are already providing the functionality of proxying we might as well allow this. So please send a PR and I'll review it 😄

wmfgerrit pushed a commit to wikimedia/mediawiki that referenced this issue Dec 23, 2016
By default the Karma proxy does requests against 'localhost', however
if the target wiki server has strict host validation (e.g. multiple
virtual hosts or otherwise strictly verified) then requests may fail
since load.php is not found. An example is with MW_SERVER=devwiki.local.

MediaWiki-Vagrant and Wikimedia CI are not affected since they use
'localhost' as the virtual host.

Set Karma proxy to change the hostname accordingly.

Reference:
 karma-runner/karma#1729
 karma-runner/karma@ae05ea4

Bug: T153757
Change-Id: I317d5686aecd1fb6cf6921cdca77670cded85607
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants