Skip to content

Conversation

@lucarosty
Copy link
Contributor

@alex-friedl : the requested patch

@alex-friedl
Copy link
Collaborator

@lucarosty Thx for the PR.

Looking this through it seems you need a way to enable enableLegacyHttpTransport even though it's deprecated?

I would prefer to keep this independent of the actual proxy support as your solution could break things for users of the httpAgent setting.

Could you test #235 and let me know if it works for you?

@lucarosty
Copy link
Contributor Author

lucarosty commented Jan 13, 2026

Yes I think that this could work for enabling the legacy transport (http1/1) that is the only one that support proxy in firebase-admin.
Do not forget to add this line in the credentials:

opts.credential.httpAgent = settings.fcm.httpAgent || undefined;

@alex-friedl
Copy link
Collaborator

Thanks for the confirmation @lucarosty!

I think it already implements exactly what you described?

Usage Example

To use the new legacyHttpTransport feature with proxy support:

const PushNotifications = require('node-pushnotifications');

const settings = {
  fcm: {
    serviceAccountKey: require('./firebase-service-account.json'),
    // Enable HTTP/1.1 transport (required for proxy support)
    legacyHttpTransport: true,
    // Optional: Configure HTTP proxy agent
    httpAgent: new HttpProxyAgent('http://proxy.example.com:8080'),
    httpsAgent: new HttpsProxyAgent('https://proxy.example.com:8080'),
  }
};

const push = new PushNotifications(settings);

// Send notifications with proxy support
await push.send(registrationIds, {
  title: 'Hello',
  body: 'World',
});

The httpAgent setting has already been added in #230

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

Successfully merging this pull request may close these issues.

2 participants