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

HP behind Lighttpd reverse https-proxy redirects to https://127.0.0.1/BASEURL #2616

Closed
maxkoryukov opened this issue Apr 20, 2016 · 5 comments

Comments

@maxkoryukov
Copy link
Contributor

I have a HP installation behind Lighttpd reverse proxy.

Here is a part of HP config:

[General]
# ....

http_proxy = 1
http_root = /headphones

# ....

HP listen for the port (lets assume 1234) on 127.0.0.1 .

But when I am trying to navigate to https://myserver.com/headphones I receive redirect to 127.0.0.1.

Here is curl log:

linux $ curl -k https://server.com/headphones/

This resource resides temporarily at <a href="https://127.0.0.1:8181/headphones/home">https://127.0.0.1:8181/headphones/home</a>.
linux $ curl -k https://server.com/headphones

This resource resides temporarily at <a href="https://127.0.0.1:8181/headphones/">https://127.0.0.1:8181/headphones/</a>.

Let me tell you: I have solved problem with some headers, so in lighttpd config I have:

$HTTP["url"] =~ "^/headphones($|/)" {

    setenv.add-request-header = (
        "X-Forwarded-Ssl" => "on"
    )

I am sure, the problem is between lighttpd and CherryPy (inside Headphones)

Does anybody know, what to do?

@maxkoryukov
Copy link
Contributor Author

Looks, like It is similar to #2052

maxkoryukov added a commit to maxkoryukov/headphones that referenced this issue Apr 20, 2016
… origin url of proxy (when HP works behind proxy)

see #rembo10#2616
maxkoryukov added a commit to maxkoryukov/headphones that referenced this issue Apr 20, 2016
* hidden-opt - now you could hide some items from dropdown lists with new meta `items-allow()`
* extended HTTP settings of HP are moved to advanced tab: HTTP_PROXY and HTTP_BASE are converted from OptionInternal to appropriate types, and now they are visible, and accessible for configuring through WebUI
* UPG: Font Awesome 4.6.1
* FIX: an opportunity to set HTTP-header, used by CherryPy to determine origin url of proxy (when HP works behind proxy)
* FIX: fixed template (OptionSwitch double caption)

see rembo10#2616
@maxkoryukov
Copy link
Contributor Author

maxkoryukov commented Apr 20, 2016

I know what the matter.

Lighttpd does not send required headers to the HP (it sends X-Host, but HP doesn't know about this...)

you could modify the sources of the HP (check next comment), or wait for merging of #2590, there is appropriate option for Lighttpd, Nginx, Apache

Thanks http://stackoverflow.com/a/36731981/1115187

@maxkoryukov
Copy link
Contributor Author

you could modify sources:

file headphones/webstart.py:

## ....
## line 65
    logger.info("Starting Headphones web server on %s://%s:%d/", protocol,
                options['http_host'], options['http_port'])
    cherrypy.config.update(options_dict)

    conf = {
        '/': {
            'tools.staticdir.root': os.path.join(headphones.PROG_DIR, 'data'),
            'tools.proxy.on': options['http_proxy'],  # pay attention to X-Forwarded-Proto header
## add this (do not forget about comma on line above):
            'tools.proxy.local': 'X-Host'   ## FIX HERE !!!!
        },

@maxkoryukov
Copy link
Contributor Author

or, tune your lighttpd to send appropriate header.

$HTTP["url"] =~ "^/headphones($|/)" {
    setenv.add-request-header = (
        "X-Forwarded-Host" => "http://your.host.com/"
    )
}

@maxkoryukov
Copy link
Contributor Author

maxkoryukov commented Apr 20, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant