1

I'm getting started using angular-oauth2-oidc with Angular 9, and using the Angular Live Development Server and authenticating with IBM Cloud Identity. I need to proxy requests to that backend and am able to configure the discovery endpoint for proxying: this is the dev server proxy config:

{
     context: ['/v1.0/endpoint/default'],
     target: 'https://prepiam.ice.ibmcloud.com',
     secure: false,
     changeOrigin: true,
     logLevel: 'debug'
},

and this is the 'issuer' endpoint that the package uses:

export const authConfig: AuthConfig = {
  issuer: '/v1.0/endpoint/default',
.......

This works great - the request is proxied and I get back the discovery document. But at this point the package uses the endpoints it got back in the document, such as

"jwks_uri": "https://prepiam.ice.ibmcloud.com/v1.0/endpoint/default/jwks",

It uses the full URL and I can't figure out how to configure a proxy rule for that. I guess I see two possibilities:

  1. somehow proxy complete URLs in the dev server and later in nginx when this work is actually deployed
  2. somehow modify the urls that the package is using, as I did with the 'issuer' endpoint above.

Any thoughts? Thanks for reading this!

Scott Johnson
  • 61
  • 1
  • 4
  • Initial thoughts are: why are you proxying in the first place and second, this proxy only works in dev, will not work in prod.. are you aware of this? – MikeOne Jul 06 '20 at 20:00
  • Hi @MikeOne I am proxying because if I don't proxy then I get a CORS error. Is there something else I should be doing? As I said, proxying works for the discovery endpoint just fine. Regarding prod - I will proxy using nginx, which I do now for all the endpoints my UI accesses. – Scott Johnson Jul 07 '20 at 11:41
  • Add CORS headers to you server config would be the way to go I guess..? – MikeOne Jul 08 '20 at 17:46

0 Answers0