{"html_url": "https://github.com/simonw/datasette/issues/1387#issuecomment-873166836", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1387", "id": 873166836, "node_id": "MDEyOklzc3VlQ29tbWVudDg3MzE2NjgzNg==", "user": {"value": 9308268, "label": "rayvoelker"}, "created_at": "2021-07-02T17:58:23Z", "updated_at": "2021-07-02T17:58:23Z", "author_association": "NONE", "body": "Thanks Simon for nailing that one down! It does seem a little confusing that the ProxyPreservehost option is set to Off By default, but this config totally did the trick and fixed the issue\r\n\r\n```\r\n\r\n ProxyPass http://127.0.0.1:8010/collection-analysis/\r\n ProxyPreservehost On\r\n\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 935930820, "label": "absolute_url() behind a proxy assembles incorrect http://127.0.0.1:8001/ URLs"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1387#issuecomment-873156408", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1387", "id": 873156408, "node_id": "MDEyOklzc3VlQ29tbWVudDg3MzE1NjQwOA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-02T17:37:30Z", "updated_at": "2021-07-02T17:37:30Z", "author_association": "OWNER", "body": "Updated documentation is here: https://docs.datasette.io/en/latest/deploying.html#apache-proxy-configuration", "reactions": "{\"total_count\": 1, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 1, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 935930820, "label": "absolute_url() behind a proxy assembles incorrect http://127.0.0.1:8001/ URLs"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1387#issuecomment-873141222", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1387", "id": 873141222, "node_id": "MDEyOklzc3VlQ29tbWVudDg3MzE0MTIyMg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-02T17:09:32Z", "updated_at": "2021-07-02T17:09:32Z", "author_association": "OWNER", "body": "I'm going to add this to the suggested Apache configuration at https://docs.datasette.io/en/stable/deploying.html#apache-proxy-configuration", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 935930820, "label": "absolute_url() behind a proxy assembles incorrect http://127.0.0.1:8001/ URLs"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1387#issuecomment-873140742", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1387", "id": 873140742, "node_id": "MDEyOklzc3VlQ29tbWVudDg3MzE0MDc0Mg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-02T17:08:40Z", "updated_at": "2021-07-02T17:08:40Z", "author_association": "OWNER", "body": "`ProxyPreserveHost On` is the Apache setting - it defaults to `Off`: https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypreservehost ", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 935930820, "label": "absolute_url() behind a proxy assembles incorrect http://127.0.0.1:8001/ URLs"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1387#issuecomment-873139138", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1387", "id": 873139138, "node_id": "MDEyOklzc3VlQ29tbWVudDg3MzEzOTEzOA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-02T17:05:47Z", "updated_at": "2021-07-02T17:05:47Z", "author_association": "OWNER", "body": "In this case the proxy is Apache. So there are a couple of potential fixes:\r\n\r\n- Configure Apache to pass the original HTTP request `Host:` header through to the proxied application. This should then be documented.\r\n- Add a new optional feature to Datasette called something like `base_host` which, if set, is always used in place of the host in `request.url` when constructing new URLs.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 935930820, "label": "absolute_url() behind a proxy assembles incorrect http://127.0.0.1:8001/ URLs"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1387#issuecomment-873137935", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1387", "id": 873137935, "node_id": "MDEyOklzc3VlQ29tbWVudDg3MzEzNzkzNQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-02T17:03:36Z", "updated_at": "2021-07-02T17:03:36Z", "author_association": "OWNER", "body": "And the links to apply a facet value are broken too! https://ilsweb.cincinnatilibrary.org/collection-analysis/current_collection-3d4a4b7/bib?_facet=bib_level_callnumber\r\n\r\n```json\r\n {\r\n \"value\": \"g l fiction\",\r\n \"label\": \"g l fiction\",\r\n \"count\": 212,\r\n \"toggle_url\": \"https://127.0.0.1:8010/collection-analysis/current_collection-3d4a4b7/bib.json?_facet=bib_level_callnumber&bib_level_callnumber=g+l+fiction\",\r\n \"selected\": false\r\n }\r\n```\r\nSame problem: https://github.com/simonw/datasette/blob/ea627baccf980d7d8ebc9e1ffff1fe34d556e56f/datasette/facets.py#L251-L261", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 935930820, "label": "absolute_url() behind a proxy assembles incorrect http://127.0.0.1:8001/ URLs"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1387#issuecomment-873136440", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1387", "id": 873136440, "node_id": "MDEyOklzc3VlQ29tbWVudDg3MzEzNjQ0MA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-02T17:01:48Z", "updated_at": "2021-07-02T17:01:48Z", "author_association": "OWNER", "body": "Here's what's happening: https://github.com/simonw/datasette/blob/d23a2671386187f61872b9f6b58e0f80ac61f8fe/datasette/views/table.py#L827-L829\r\n\r\nThis is being run through `absolute_url()` - defined here: https://github.com/simonw/datasette/blob/d23a2671386187f61872b9f6b58e0f80ac61f8fe/datasette/app.py#L633-L637\r\n\r\nThat's because the `next_url` in the JSON needs to be a full URL that a client can retrieve - as opposed to the other links on that page which are all relative links that start with `/`: https://github.com/simonw/datasette/blob/ea627baccf980d7d8ebc9e1ffff1fe34d556e56f/datasette/templates/_table.html#L11-L15\r\n\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 935930820, "label": "absolute_url() behind a proxy assembles incorrect http://127.0.0.1:8001/ URLs"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1387#issuecomment-873134866", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1387", "id": 873134866, "node_id": "MDEyOklzc3VlQ29tbWVudDg3MzEzNDg2Ng==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-02T16:58:52Z", "updated_at": "2021-07-02T16:58:52Z", "author_association": "OWNER", "body": "What's weird here is that the URL itself is correct - it starts with `/collection-analysis/` as expected - but the hostname is wrong.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 935930820, "label": "absolute_url() behind a proxy assembles incorrect http://127.0.0.1:8001/ URLs"}, "performed_via_github_app": null}