I don't like this "quirk" either. Really, the "<base>" element is
configuration, whereas your HTML is an application that should be able to
run anywhere. But... I also don't see a way around this. It's part of the
reason I also prefer the HashLocationStrategy over the default strategy.

You should not have an issue if access is always through the proxy. The
base element should reference the proxied URL.

You may be able to do something on your webserver by rewriting the HTML
dynamically to put the correct href value, but that may be difficult and it
only makes sense when you know all the possible mappings for your
application.

-Luke

On Tue, Jun 28, 2016 at 8:20 AM, William Davis <[email protected]>
wrote:

> I may have looked over something obvious, but I am having trouble getting
> my angular2 app to work through a proxy. To my understanding I have to
> hardcode the base href for the app and the router to work, this seems
> problematic when the base url can change if I am going through a proxy. For
> example, if I host my app at http://mysite.com/ng2-app/ and then proxy to
> http://mysite.com/public/app/ I get an error in the browser console:
> *Cannot match any routes. Current segment: 'public'. Available routes:
> ['/sample', '/request-form', '/', '/request-view'].*
>
> Is there a way to make the app relative to their root URL and never
> hardcode the root? Am I misunderstanding how something works or overlooking
> something?
>
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Lucas Lacroix
Computer Scientist
System Technology Division, MEDITECH <http://ehr.meditech.com>
781-774-2293

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to