Skip to content
This repository has been archived by the owner on Feb 25, 2022. It is now read-only.

Proxy strains does not work on URL path #64

Closed
hirenoble opened this issue May 1, 2019 · 12 comments · Fixed by #71
Closed

Proxy strains does not work on URL path #64

hirenoble opened this issue May 1, 2019 · 12 comments · Fixed by #71
Assignees
Labels
enhancement New feature or request released

Comments

@hirenoble
Copy link

Description
Proxy strain works for host but not on the full URL path.

To Reproduce

Expected behavior
fetching origin from https://adobedocs.github.io/developer-support/

Screenshots
fetches https://adobedocs.github.io/support
image

Version:
1.0.0

Additional context
Current proxy strain creates rule for host but doesn't take path into consideration.

set req.http.host = "adobedocs.github.io";

it should be:
set req.http.host = "adobedocs.github.io";
set req.url = "/developer-support/";

@filmaj
Copy link

filmaj commented May 1, 2019

See https://github.com/adobe/developer.adobe.com/pull/137 for related PR for devsite

@hirenoble hirenoble changed the title Proxy strains works does not work on URL path Proxy strains does not work on URL path May 1, 2019
@trieloff trieloff transferred this issue from adobe/helix-cli May 2, 2019
@trieloff
Copy link
Contributor

trieloff commented May 2, 2019

Hi @hirenoble - that's definitely a bug. Thanks for reporting.

@trieloff trieloff added the bug Something isn't working label May 2, 2019
@trieloff trieloff self-assigned this May 2, 2019
@trieloff
Copy link
Contributor

trieloff commented May 2, 2019

I had another look at it, and it's a missing feature, not a bug. Something we want to have nonetheless, but it will take a bit of work.

@trieloff trieloff added enhancement New feature or request and removed bug Something isn't working labels May 2, 2019
@trieloff
Copy link
Contributor

trieloff commented May 2, 2019

As a quick workaround, you might want to align the two paths, so either have /support in both sites or /developer-support in both sites. I may need until next week to get this fixed.

trieloff added a commit to adobe/helix-shared that referenced this issue May 2, 2019
@hirenoble
Copy link
Author

@trieloff, Thank you for looking into this. I tried your suggested approach to change the github page URL to /support. Now I'm seeing another issue. https://developer.adobe.com/support is simply redirecting to https://adobedocs.github.io/support whereas what I want is to browser URL to remain https://developer.adobe.com/support and it should serve the content from github page.

Here is an example of the expected behavior: https://anything.helix-demo.xyz/support

VCL I used:
sub vcl_miss
{
if(req.url == "/support" || req.url == "/support/"){
set req.backend = F_Github;
set bereq.http.host = "adobedocs.github.io";
set bereq.url = "/support/";
}
}

so in helix proxy->Fastly rules we may want to set bereq.http.host and bereq.url

@trieloff
Copy link
Contributor

trieloff commented May 2, 2019

Yep, in adobe/helix-shared#104 I have added the ability to set the override_host property, which is exactly what you need.

@hirenoble
Copy link
Author

@trieloff It's because the GitHub pages behavior, https://adobedocs.github.io/support it will give you a 301 redirect if you hit https://adobedocs.github.io/support/ it gives 200 OK.

so currently https://developer.adobe.com/support/ gives us the expected result whereas https://developer.adobe.com/support will get redirected.

I think with your fix to have proxy on full path url this should get fixed as we will be mapping developer.adobe.com/support to adobedocs.github.io/support/

@trieloff
Copy link
Contributor

trieloff commented May 3, 2019

You might also want to try to add a redirect rule:

redirects:
  - from: ^/support$
    to: /support/

the redirect rule should be executed before the request hits the GitHub backend, so you'll never see the faulty redirect from GitHub.

trieloff added a commit that referenced this issue May 6, 2019
Until now, proxy strains and runtime strains differed in the handling of strain URL paths. Runtime strain would effectively cut off the part of the URL that was used for strain resolution while proxy strains kept it. This change aligns the behavior and also allows specifying a backend root path in the origin of a proxy strain, allowing URL rewrites so that content requested from https://helixdomain.com/newpath could be served from https://backenddomain.com/oldpath.

BREAKING CHANGE: changes root paths of all proxy strains - fixes #64
@trieloff
Copy link
Contributor

trieloff commented May 6, 2019

Fixed, but requires hlx-cli>=2.0.0

@filmaj filmaj reopened this May 9, 2019
@filmaj
Copy link

filmaj commented May 9, 2019

Still seeing the same issue w/ helix-cli 2.1.6.

Relevant helix config part:

  - name: support-staging
    origin: https://adobedocs.github.io/developer-support/
    url: https://adobedevsite.helix-demo.xyz/support

Run hlx up --host adobedevsite.helix-demo.xyz --local-repo=., then load http://localhost:3000/support

Get a 404 page, and hlx up output says:

[hlx] info: Proxy GET request to https://adobedocs.github.io:443/support

The expectation is that hlx up output would provide the correct path to the github.io URL.

@trieloff
Copy link
Contributor

Closing this one, as adobe/helix-simulator#213 is the correct issue for the localhost scenario.

adobe-bot pushed a commit that referenced this issue Jun 24, 2019
# 1.0.0 (2019-06-24)

### Bug Fixes

* **static:** process ESI for static resources, too ([8ea480d](8ea480d))
* .snyk & package.json to reduce vulnerabilities ([d68bf41](d68bf41))
* .snyk & package.json to reduce vulnerabilities ([c2314e5](c2314e5))
* **deploy:** use nodejs:10 container ([b64541e](b64541e)), closes [#55](#55)
* **dictionaries:** set missing directory index ([ef56581](ef56581)), closes [#59](#59)
* **linting:** linting again... ([b496576](b496576))
* **linting:** linting... ([275494f](275494f))
* **monitoring:** remove epsagon token from source code ([be35e31](be35e31))
* **package:** update @adobe/fastly-native-promises to version 1.10.0 ([258c5eb](258c5eb))
* **package:** update @adobe/fastly-native-promises to version 1.4.0 ([c29ed05](c29ed05))
* **package:** update @adobe/fastly-native-promises to version 1.6.0 ([dba6bd0](dba6bd0)), closes [#17](#17)
* **package:** update @adobe/fastly-native-promises to version 1.6.1 ([8b755ae](8b755ae))
* **package:** update @adobe/fastly-native-promises to version 1.7.0 ([8955790](8955790))
* **package:** update @adobe/fastly-native-promises to version 1.8.0 ([23c37eb](23c37eb))
* **package:** update @adobe/fastly-native-promises to version 1.9.0 ([68c16f6](68c16f6))
* **package:** update @adobe/fastly-native-promises to version 1.9.1 ([de465f3](de465f3))
* **package:** update @adobe/helix-shared to version 0.10.3 ([7c9caef](7c9caef))
* **package:** update @adobe/helix-shared to version 0.10.4 ([d4b5e92](d4b5e92))
* **package:** update @adobe/helix-shared to version 0.10.5 ([fd67213](fd67213))
* **package:** update @adobe/helix-shared to version 0.11.0 ([d976bcb](d976bcb))
* **package:** update @adobe/helix-shared to version 0.6.2 ([20703f3](20703f3))
* **package:** update @adobe/helix-shared to version 0.7.0 ([d49ba13](d49ba13))
* **package:** update @adobe/helix-shared to version 0.8.0 ([4731732](4731732))
* **package:** update @adobe/helix-shared to version 0.8.1 ([024f137](024f137))
* **package:** update @adobe/helix-shared to version 0.8.3 ([6dd418b](6dd418b))
* **package:** update @adobe/helix-shared to version 0.8.4 ([feaf8eb](feaf8eb))
* **package:** update @adobe/helix-shared to version 1.0.1 ([ffad201](ffad201)), closes [#67](#67)
* **package:** update @adobe/helix-shared to version 1.0.2 ([f3c27b6](f3c27b6))
* **package:** update @adobe/helix-shared to version 1.1.1 ([c1bf275](c1bf275))
* **package:** update @adobe/helix-shared to version 1.2.0 ([41faf50](41faf50))
* **package:** update @adobe/helix-shared to version 1.3.1 ([d002710](d002710))
* **package:** update @adobe/helix-shared to version 1.5.0 ([1a61355](1a61355))
* **package:** update fs-extra to version 8.0.1 ([cffa67c](cffa67c))
* **package:** update glob-to-regexp to version 0.4.1 ([5b0782f](5b0782f))
* **proxy:** Don't attempt to recover from 404 errors in proxy strains ([8b84690](8b84690)), closes [#75](#75)
* **proxy:** prevent duplicate creation of backends for proxy strains ([c157e8b](c157e8b))
* **proxy:** use FastlyJSON when talking to Fastly API ([9d40b93](9d40b93))
* **static:** add missing slash to GitHub raw URL ([c07f401](c07f401))
* **static:** disable GZip for all backend requests that could contain ESI ([393ae0a](393ae0a))
* **static:** don't redeclare var ([3f23556](3f23556))
* **static:** drop accept-encoding to enforce esi ([2729f64](2729f64))
* **static:** enable compression for ESI-processed resources ([0eaf027](0eaf027))
* **static:** fix syntax error ([852969a](852969a))
* **static:** fix syntax error ([82949b0](82949b0))
* **static:** fix syntax error ([d22c465](d22c465))
* **static:** fix variable name ([cbb125e](cbb125e))
* **static:** fix VCL syntax error ([db4c524](db4c524))
* **static:** fix VCL syntax error ([76749d6](76749d6))
* **static:** handle immutable requests without restart ([79c0ba7](79c0ba7))
* **static:** move esi handling into fetch ([46bc081](46bc081))
* **static:** never use GZip when talking with Runtime, as there might be ESI ([21ce4a1](21ce4a1))
* **static:** no slash between ref and path in static retrieval ([209cd7f](209cd7f))
* **static:** protect against cache poisoning by verifying the etag ([1bc1e24](1bc1e24))
* **static:** remove brackets in URL ([4009ff5](4009ff5))
* **static:** restrict regex for immutable resources ([c71043f](c71043f))
* **static:** strip 302 from URL when requesting a redirect ([fd5a5db](fd5a5db))
* **static:** submit location headers for redirects, making actual redirects possible ([615bf33](615bf33))
* **static:** throw error for invalid resource paths ([92d4c82](92d4c82))
* **static:** turn on ESI processing when backend response requests it ([5459d30](5459d30))
* **static:** unset Accept-Encoding more aggressively ([df42f20](df42f20))
* **static:** use beresp instead of resp for ETag value ([112796d](112796d))
* **static:** use correct location header ([5d1f8c7](5d1f8c7))
* **static:** use correct path for entry for immutable resources ([c66f15f](c66f15f))
* **static:** use local var for new extension ([c995533](c995533))
* **static:** use re instead of req ([245b583](245b583))
* **static:** use req for tracing instead of resp ([806d48d](806d48d))
* **vcl:** bum version ([73d3f8e](73d3f8e))
* **vcl:** copyright & unrelated change ([e88ed93](e88ed93))
* **vcl:** include must be outside of a subroutine ([cef774f](cef774f))
* **vcl:** is line break required ? ([67080b2](67080b2))
* **vcl:** is linebreak required? ([9cc1ea2](9cc1ea2))
* **vcl:** remove unnecessary line breaks ([8502341](8502341))
* **vcl:** respect remapped url also in static ([f404c4d](f404c4d)), closes [#101](#101)

### Features

* **monitoring:** add epsagon wrapper ([2d52627](2d52627)), closes [#104](#104)
* **proxy:** make proxy strains respect the URL path and backend path ([ff77ba7](ff77ba7))
* **static:** enable asset statification for assets loaded from static URLs ([befc1e2](befc1e2))
* **static:** provide two new resource types for static resources: .esi to replace a static URL with a cacheable static URL and .hlx_[0-9a-f]+ for resources that are cached forever in the browser ([9f8e52c](9f8e52c)), closes [/github.com/adobe/helix-pipeline/issues/224#issuecomment-476690621](https://github.com//github.com/adobe/helix-pipeline/issues/224/issues/issuecomment-476690621)
* **static:** rename static-esi to static-url, introduce static-302 which returns a redirect ([403ae1b](403ae1b)), closes [/github.com//pull/61#issuecomment-487664612](https://github.com//github.com/adobe/helix-publish/pull/61/issues/issuecomment-487664612)
* **vcl:** Add extensions.vcl ([ae1b52c](ae1b52c))
* **vcl:** add more extension points ([979cfbe](979cfbe))
* **vcl:** Add more extension points ([3dee07e](3dee07e))
* **vcl:** Documentation ([902f6f3](902f6f3))
* **vcl:** Support Custom VCL ([b2ca735](b2ca735))
* **vcl:** testing extension logic ([717c192](717c192))
* **vcl:** Tests for synthetize method ([71bcd2d](71bcd2d))

### Performance Improvements

* **static:** declare static files to be immutable ([f0369b7](f0369b7))

### BREAKING CHANGES

* **proxy:** changes root paths of all proxy strains - fixes #64
@adobe-bot
Copy link
Contributor

🎉 This issue has been resolved in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants