'Primary' domain in server block?

Hi

I’m doing some work with PayPal integration. My server block looks like
this:

server {
server_name dev01.localmap.net dev01.devsite.co.uk;

}

The work is being done in under ‘dev01.devsite.co.uk’ domain. However,
for
link backs from PayPal, it is working out that it should be ’
dev01.localmap.net’. If I switch the two around in the server block,
then
PayPal picks that up.

How is PayPal doing that? And are there any config settings I can use to
change this behaviour?

It is not a major issue, mainly it is confusing some testers who are
‘losing’ cookie data. I’m looking to explain the situation and make sure
we
have a nice solution to it.

Thanks,
Tom

On Thu, Mar 07, 2013 at 09:30:01AM +0000, Tom Barrett wrote:

Hi there,

I’m doing some work with PayPal integration.

How does nginx talk to your PayPal integration system?

proxy_pass, fastcgi_pass, something else?

The work is being done in under ‘dev01.devsite.co.uk’ domain. However, for
link backs from PayPal, it is working out that it should be ’
dev01.localmap.net’. If I switch the two around in the server block, then
PayPal picks that up.

In nginx, the variable $server_name is the first entry for the
server_name
directive in the appropriate server{} block.

There are circumstances in which the variable $host will take that
value.

How is PayPal doing that?

Presumably you’re giving the information it to PayPal somehow?

And are there any config settings I can use to
change this behaviour?

Probably. What’s your current relevant config?

f

Francis D. [email protected]

On Fri, Mar 08, 2013 at 08:53:34AM +0000, Tom Barrett wrote:

On 7 March 2013 17:06, Francis D. [email protected] wrote:

On Thu, Mar 07, 2013 at 09:30:01AM +0000, Tom Barrett wrote:

Hi there,

I think perhaps my use of the word ‘integration’ was a little
grandiose. The general server setup is PHP fastcgi with a WordPress
installation.

So: fastcgi is involved.

nginx interacts with the fastcgi server by sending key/value pairs from
fastcgi_param directives. That is (pretty much) all it does.

The fastcgi server will (typically) use some specific fastcgi_param
keys for itself, and then make all of the key/values available to the
php script.

What happens after that is nothing to do with nginx.

How is PayPal doing that?

Presumably you’re giving the information it to PayPal somehow?

So, however PayPal is grabbing it’s information, it gets the first entry in
the server_name directive. And that’s my only option?

No. It sounds like your php script is talking to PayPal, and so your php
script is sending the information. If you know what information you want
to send, either change your php script to send only that; or else read
your php script to see what key names it uses, and change your nginx to
send the values you want for those keys.

Well, assuming my above statement is correct, then only the server_name
directive is relevant?

That depends on what your php script does.

It is a pretty trivial setup: http://pastebin.com/SdaB1ZW4

My guess is that your php script uses the value of SERVER_NAME when it
talks to PayPal. Your config sets SERVER_NAME to whatever $server_name
is
(in the fastcgi_param directives, in the “include” file).

If my guess is correct, then if you send SERVER_NAME with the value of
www.example.com”, then that’s what PayPal will see, and will use.

You have the php script; you don’t need to guess.

You can set a fixed string, or you can use another variable – perhaps
$host is closer to what you want it to be. Or maybe PayPal will use some
other key if SERVER_NAME is not set to anything. It shouldn’t be too
difficult to set up a test system to learn some of what PayPal is doing.

Good luck with it,

f

Francis D. [email protected]

On 7 March 2013 17:06, Francis D. [email protected] wrote:

On Thu, Mar 07, 2013 at 09:30:01AM +0000, Tom Barrett wrote:

Hi there,

Thanks for reading :slight_smile:

I’m doing some work with PayPal integration.

How does nginx talk to your PayPal integration system?

I think perhaps my use of the word ‘integration’ was a little
grandiose. The general server setup is PHP fastcgi with a WordPress
installation.
The link to the PayPal account is via a simple HTML form with a price
and
submit button.

In nginx, the variable $server_name is the first entry for the
server_name

directive in the appropriate server{} block.

There are circumstances in which the variable $host will take that value.

How is PayPal doing that?

Presumably you’re giving the information it to PayPal somehow?

So, however PayPal is grabbing it’s information, it gets the first entry
in
the server_name directive. And that’s my only option?

And are there any config settings I can use to
change this behaviour?

Probably. What’s your current relevant config?

Well, assuming my above statement is correct, then only the server_name
directive is relevant?

It is a pretty trivial setup: http://pastebin.com/SdaB1ZW4