prebid / prebid-server

Open-source solution for running real-time advertising auctions in the cloud.
https://prebid.org/product-suite/prebid-server/
Apache License 2.0
424 stars 720 forks source link

Should prebid server listen to port 443 instead of 8000? #690

Closed Wade-McDaniel closed 6 years ago

Wade-McDaniel commented 6 years ago

Greetings,

I'm just getting started with Prebid Server, currently setting up the server itself indending it to work with our Google AMP ads, and I have some questions I'm hoping you can help me with:

  1. Where in the example Stored Request on this page do I specify my Prebid Server endpoint?
  2. Your readme.md seems to indicate that if I run the prebid-server I've built, it listens to port 8000. Shouldn't it listen to port 443, or do I specify port number in my endpoint URL (however i do that in #1 above)?
  3. Is there an end-to-end example of Google AMP + Prebid Server somewhere you might point me at, or is this the only example: http://prebid.org/dev-docs/show-prebid-ads-on-amp-pages.html?

Thank you!

dbemiller commented 6 years ago
  1. In AMP, the PBS endpoint comes from the rtc-config on the AMP page itself. If you're providing Prebid as a service, you might want to add yourself as a callout vendor

  2. The port is configurable. It binds to the PBS_PORT environment variable.

  3. That's the only example I'm aware of.

Wade-McDaniel commented 6 years ago

Thank you for helping me with this, @dbemiller !

Your answer to #2 makes sense. Thanks for that!

But I'm still confused on how to specify the Prebid Server URL in the first item on this page: http://prebid.org/dev-docs/how-prebid-on-amp-works.html That's sort of what I was going for with my first question.

Would you know of a site that uses Prebid Server from Google AMP pages you might point me at, and I can reverse-engineer what they did to maybe figure out how to point the AMP ads in a page at the Prebid server instance I'm setting up?

dbemiller commented 6 years ago

From the docs:

<amp-ad width="300" height="250" type="doubleclick" data-slot="/19968336/universal_creative" rtc-config='{"vendors": {"prebidappnexus": {"PLACEMENT_ID": "13144370"}}, "timeoutMillis": 500}'>

Note the prebidappnexus.

The AMP project includes prebidappnexus as an rtc-config vendor:

  prebidappnexus: {
    url: 'https://prebid.adnxs.com/pbs/v1/openrtb2/amp?tag_id=PLACEMENT_ID&w=ATTR(width)&h=ATTR(height)&ow=ATTR(data-override-width)&oh=ATTR(data-override-height)&ms=ATTR(data-multi-size)&slot=ATTR(data-slot)&targeting=TGT&curl=CANONICAL_URL&timeout=TIMEOUT&adcid=ADCID&purl=HREF',
    macros: ['PLACEMENT_ID'],
    disableKeyAppend: true,
  },

That's where the URL comes from in the docs example.

As a single publisher, you might be able to just use a custom url in your rtc-config... but I'm not sure whether all the same URL macros are available there.

Wade-McDaniel commented 6 years ago

I guess that's what makes me confused. What you sent looks to me more like the AMP Fast Fetch, where the bid requests go straight from the page to the ad partners and back to the page and then to DFP bypassing any need for Prebid Server. I don't get where any Prebid Server instance I set up fits into that equation.

I through the flow was AMP Ad -> my Prebid Server instance -> the ad partners -> my Prebid Server instance > AMP Ad -> DFP. but what you seem to describe looks more like AMP Ad -> the ad partners -> AMP Ad -> DFP. For the prebidappnexus example you sent, doesn't the amp-ad just ask prebid.adnxs.com for bids and any Prebid Server instance I set up gets ignored?

Apologies for being slow to understand how this all fits together...

hhhjort commented 6 years ago

The prebidappnexus vendor is a "vendor" configured to hit the AppNexus hosted prebid server instance. So that example goes through a prebid server to get all bidders, it is not restricted to just AppNexus bidding.

If you are just a single publisher with your own prebid server instance, you may want to use the rtc-config: url specification rather than setting up an official vendor definition in AMP. The vendors in rtc-config are basically macro shortcuts to a url definition to make the config cleaner and smaller.

Wade-McDaniel commented 6 years ago

Ok, so I'm not so crazy :) By default, amp-ad DOES go to each adapter endpoint hosted at each partner's server: prebidappnexus params go to prebidadnxs.com to get it's bids, rubicon goes to prebid-server.rubiconproject.com to get its' bids, etc.

But if I configure my amp-ad to be as you described, specifying a different URL for the AppNexus endpoint: <amp-ad width="300" height="250" type="doubleclick" data-slot="/19968336/universal_creative" rtc-config='{"vendors": {"prebidappnexus": {"PLACEMENT_ID": "13144370","url":"https://myprebidserver.com/openrtb2/amp?tag_id=PLACEMENT_ID&w=ATTR(width)&h=ATTR(height)&ow=ATTR(data-override-width)&oh=ATTR(data-override-height)&ms=ATTR(data-multi-size)&slot=ATTR(data-slot)&targeting=TGT&curl=CANONICAL_URL&timeout=TIMEOUT&adcid=ADCID&purl=HREF"}}, "timeoutMillis": 500}'> Then that will send one request back to myprebidserver.com?

If so, then how do I get my Prebid Server instance to take that one AppNexus PlacementID bid request and make requests to AppNexus and all of our other partners to get bids from everyone (everyone that supports Prebid Server that is)?

Or do I maybe just include every partner we use (that Prebid Server supports, up to 5) in the rtc-config and override each url to use myprebidserver.com?

dbemiller commented 6 years ago

For that, you need Stored Requests.

You'll need to set up some sort of backend to save that data on your server, and then configure PBS to read from it (more env variables). Right now PBS has backends for flat text files, Postgres, and a REST endpoint... but feel free to submit a PR if you have another backend in mind.

The Stored Request data should have all the Bidders & Params you need.

The AMP API is something like: /openrtb2/amp?tag_id=ID, where ID should be the ID of the Stored Request you want to run.

hhhjort commented 6 years ago

Also not that you don't want to use both prebidappnexus and your own prebid instance. prebidappnexus is a prebid server instance that appnexus hosts, not a call to an appnexus endpoint that serves only appnexus traffic. So if you call both (and both can respond with actual bids) they will stomp on each other in setting the key values pairs for DFP.

As dbemiller noted, the tag_id=ID is an arbitrary ID that you get to define on your own prebid server instance. On the AppNexus prebid server instance, there is a convention that this ID ties to an AppNexus placement ID. This is an AppNexus convention, not a prebid server convention.

Wade-McDaniel commented 6 years ago

OK, thanks you two! I think I'm getting it now.

So to use my own instance for AMP ads via Prebid server, I think I get

The last thing that I don't understand then is: what would my tag look to use a Stored Request POST at https://myprebidserver.com/openrtb2/amp?tag_id=[my_tag_id]?

hhhjort commented 6 years ago

Oh, one other potential issue, I don't believe prebid server will handle SSL certs ... usually you have the load balancer handle SSL certs and then all traffic use http behind that. if you are routing all traffic directly to your prebid instance then that could be an issue for https traffic.

hhhjort commented 6 years ago

Your example above was going in the correct direction: <amp-ad width="300" height="250" type="doubleclick" data-slot="/19968336/universal_creative" rtc-config='{"url": ["https://myprebidserver.com/openrtb2/amp?tag_id=PLACEMENT_ID&w=ATTR(width)&h=ATTR(height)&ow=ATTR(data-override-width)&oh=ATTR(data-override-height)&ms=ATTR(data-multi-size)&slot=ATTR(data-slot)&targeting=TGT&curl=CANONICAL_URL&timeout=TIMEOUT&adcid=ADCID&purl=HREF"], "timeoutMillis": 500}'>

I am just not sure on the macro support in custom URLs vs defined vendors in amp rtc.

Wade-McDaniel commented 6 years ago

Cool, I think I can get started actually firing this thing up - thanks for all the help, @hhhjort and @dbemiller !

Regarding port 443: maybe an .htaccess proxy rule could route from myprebidserver.com:443 to localhost:8000...but I'm not sure if that'll pass the SSL certs through. But I'll cross that bridge when I get to it. I know tho that AMP requires HTTPS, and making a POST from HTTPS to HTTP should be a permissions violation, so I would think we'd need to stick with port 443.

I'm off to try this out. Thanks again!