Apache UseCanonicalName On isnt passing ServerName to CGI The 2019 Stack Overflow Developer Survey Results Are InApache2 - mod_expire and mod_rewrite not working in httpd.conf - serving content from tomcat(13) Permission denied on Apache CGI attemptgzip compression using mod_deflate apache with tomcatRequire ServerName in VirtualHostApache ever match a virtual host with a different ServerNameForbidden Access. CGI -apachePassing Apache variable into SetHandler directiveissue with Apache and CGI scriptApache ServerName being ignoredApache CGI-Bin Hot Update
How to make payment on the internet without leaving a money trail?
Is domain driven design an anti-SQL pattern?
What could be the right powersource for 15 seconds lifespan disposable giant chainsaw?
Why is my p-value correlated to difference between means in two sample tests?
What tool would a Roman-age civilization have to grind silver and other metals into dust?
How can I create a character who can assume the widest possible range of creature sizes?
What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?
What is this 4-propeller plane?
What does Linus Torvalds mean when he says that Git "never ever" tracks a file?
It's possible to achieve negative score?
If the Wish spell is used to duplicate the effect of Simulacrum, are existing duplicates destroyed?
Is it possible for the two major parties in the UK to form a coalition with each other instead of a much smaller party?
JSON.serialize: is it possible to suppress null values of a map?
Dual Citizen. Exited the US on Italian passport recently
Limit the amount of RAM Mathematica may access?
What do the Banks children have against barley water?
What is the meaning of Triage in Cybersec world?
Output the Arecibo Message
Understanding the implication of what "well-defined" means for the operation in quotient group
Could JWST stay at L2 "forever"?
What is the motivation for a law requiring 2 parties to consent for recording a conversation
Patience, young "Padovan"
How are circuits which use complex ICs normally simulated?
How to deal with fear of taking dependencies
Apache UseCanonicalName On isnt passing ServerName to CGI
The 2019 Stack Overflow Developer Survey Results Are InApache2 - mod_expire and mod_rewrite not working in httpd.conf - serving content from tomcat(13) Permission denied on Apache CGI attemptgzip compression using mod_deflate apache with tomcatRequire ServerName in VirtualHostApache ever match a virtual host with a different ServerNameForbidden Access. CGI -apachePassing Apache variable into SetHandler directiveissue with Apache and CGI scriptApache ServerName being ignoredApache CGI-Bin Hot Update
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
On Apache 2.4 in in a virtualhost I have:
UseCanonicalName On
ServerName somename
ServerAlias www.someothername.com
According to the docs:
With UseCanonicalName On Apache will use the hostname and port
specified in the ServerName directive to construct the canonical name
for the server. This name is used in all self-referential URLs, and
for the values of SERVER_NAME and SERVER_PORT in CGIs.
So in my Tomcat/CFML application when I visit the URL www.someothername.com
I would expect to see in the CGI scope:
server_name: somename
but instead I get:
server_name: www.someothername.com
It's like the directive is totally ignored.
# Proxy CFML files to Tomcat
RewriteCond %REQUEST_FILENAME /[^/:]+.cfml*($|/)
RewriteRule (.*) ajp://%HTTP_HOST:8009$1 [P,L]
I also tried:
RewriteRule (.*) ajp://%SERVER_NAME:8009$1 [P,L]
and using mod_proxy instead of AJP:
RewriteRule (.*) http://%SERVER_NAME:8888$1 [P,L]
The last 2 cause a DNS lookup on somename
but still returns www.someothername.com
in the CGI.SERVER_NAME field
I should point out that the only reason I'm doing this is because I'm doing mass virtual-hosting with mod_cfml
to automaticatically create tomcat contexts and I would like the context and application to use a short name derived from the vhost configuration. I guess I could just set a header (even rewrite the Host: header) but using ServerName seemed the most elegant solution.
UPDATE: There is something I noticed in the client headers that is probably relevant. There are 2 headers I haven't seen before:
x-forwarded-host: www.someothername.com
x-forwarded-server: somename
I need to know what set these headers and why. I'm assuming it was either Tomcat or mod_cfml. Can I rely on the x-forwarded-server
value to always be ServerName?
tomcat apache-2.4
add a comment |
On Apache 2.4 in in a virtualhost I have:
UseCanonicalName On
ServerName somename
ServerAlias www.someothername.com
According to the docs:
With UseCanonicalName On Apache will use the hostname and port
specified in the ServerName directive to construct the canonical name
for the server. This name is used in all self-referential URLs, and
for the values of SERVER_NAME and SERVER_PORT in CGIs.
So in my Tomcat/CFML application when I visit the URL www.someothername.com
I would expect to see in the CGI scope:
server_name: somename
but instead I get:
server_name: www.someothername.com
It's like the directive is totally ignored.
# Proxy CFML files to Tomcat
RewriteCond %REQUEST_FILENAME /[^/:]+.cfml*($|/)
RewriteRule (.*) ajp://%HTTP_HOST:8009$1 [P,L]
I also tried:
RewriteRule (.*) ajp://%SERVER_NAME:8009$1 [P,L]
and using mod_proxy instead of AJP:
RewriteRule (.*) http://%SERVER_NAME:8888$1 [P,L]
The last 2 cause a DNS lookup on somename
but still returns www.someothername.com
in the CGI.SERVER_NAME field
I should point out that the only reason I'm doing this is because I'm doing mass virtual-hosting with mod_cfml
to automaticatically create tomcat contexts and I would like the context and application to use a short name derived from the vhost configuration. I guess I could just set a header (even rewrite the Host: header) but using ServerName seemed the most elegant solution.
UPDATE: There is something I noticed in the client headers that is probably relevant. There are 2 headers I haven't seen before:
x-forwarded-host: www.someothername.com
x-forwarded-server: somename
I need to know what set these headers and why. I'm assuming it was either Tomcat or mod_cfml. Can I rely on the x-forwarded-server
value to always be ServerName?
tomcat apache-2.4
add a comment |
On Apache 2.4 in in a virtualhost I have:
UseCanonicalName On
ServerName somename
ServerAlias www.someothername.com
According to the docs:
With UseCanonicalName On Apache will use the hostname and port
specified in the ServerName directive to construct the canonical name
for the server. This name is used in all self-referential URLs, and
for the values of SERVER_NAME and SERVER_PORT in CGIs.
So in my Tomcat/CFML application when I visit the URL www.someothername.com
I would expect to see in the CGI scope:
server_name: somename
but instead I get:
server_name: www.someothername.com
It's like the directive is totally ignored.
# Proxy CFML files to Tomcat
RewriteCond %REQUEST_FILENAME /[^/:]+.cfml*($|/)
RewriteRule (.*) ajp://%HTTP_HOST:8009$1 [P,L]
I also tried:
RewriteRule (.*) ajp://%SERVER_NAME:8009$1 [P,L]
and using mod_proxy instead of AJP:
RewriteRule (.*) http://%SERVER_NAME:8888$1 [P,L]
The last 2 cause a DNS lookup on somename
but still returns www.someothername.com
in the CGI.SERVER_NAME field
I should point out that the only reason I'm doing this is because I'm doing mass virtual-hosting with mod_cfml
to automaticatically create tomcat contexts and I would like the context and application to use a short name derived from the vhost configuration. I guess I could just set a header (even rewrite the Host: header) but using ServerName seemed the most elegant solution.
UPDATE: There is something I noticed in the client headers that is probably relevant. There are 2 headers I haven't seen before:
x-forwarded-host: www.someothername.com
x-forwarded-server: somename
I need to know what set these headers and why. I'm assuming it was either Tomcat or mod_cfml. Can I rely on the x-forwarded-server
value to always be ServerName?
tomcat apache-2.4
On Apache 2.4 in in a virtualhost I have:
UseCanonicalName On
ServerName somename
ServerAlias www.someothername.com
According to the docs:
With UseCanonicalName On Apache will use the hostname and port
specified in the ServerName directive to construct the canonical name
for the server. This name is used in all self-referential URLs, and
for the values of SERVER_NAME and SERVER_PORT in CGIs.
So in my Tomcat/CFML application when I visit the URL www.someothername.com
I would expect to see in the CGI scope:
server_name: somename
but instead I get:
server_name: www.someothername.com
It's like the directive is totally ignored.
# Proxy CFML files to Tomcat
RewriteCond %REQUEST_FILENAME /[^/:]+.cfml*($|/)
RewriteRule (.*) ajp://%HTTP_HOST:8009$1 [P,L]
I also tried:
RewriteRule (.*) ajp://%SERVER_NAME:8009$1 [P,L]
and using mod_proxy instead of AJP:
RewriteRule (.*) http://%SERVER_NAME:8888$1 [P,L]
The last 2 cause a DNS lookup on somename
but still returns www.someothername.com
in the CGI.SERVER_NAME field
I should point out that the only reason I'm doing this is because I'm doing mass virtual-hosting with mod_cfml
to automaticatically create tomcat contexts and I would like the context and application to use a short name derived from the vhost configuration. I guess I could just set a header (even rewrite the Host: header) but using ServerName seemed the most elegant solution.
UPDATE: There is something I noticed in the client headers that is probably relevant. There are 2 headers I haven't seen before:
x-forwarded-host: www.someothername.com
x-forwarded-server: somename
I need to know what set these headers and why. I'm assuming it was either Tomcat or mod_cfml. Can I rely on the x-forwarded-server
value to always be ServerName?
tomcat apache-2.4
tomcat apache-2.4
edited Feb 3 '14 at 4:16
SpliFF
asked Feb 3 '14 at 3:16
SpliFFSpliFF
2492622
2492622
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You're not calling a CGI, you're proxying, so trying to set SERVER_NAME is either useless or very close to it.
Typically with mass virtual hosting you should use the actual domain name that you received, which is HTTP_HOST, the Host:
HTTP header, in your application to make the distinction.
That makes some sense except that CFML engines DO emulate CGI and provide a CGI scope containing the fields you would expect. For point 2 I do not want seperate "contexts" based on the FQDN used by the client. What I want is many FQDN aliases all pointing to the same "shortname" context. I do want to preserve the 'Host' header information but I need the "true" ServerName as well.
– SpliFF
Feb 3 '14 at 4:31
Hmm. You'll have to get it elsewhere, then, I think. Perhaps that mysterious header you mentioned? It should only take a moment to test whether that behaves the way you expect.
– Michael Hampton♦
Feb 3 '14 at 4:32
Thanks but I think you're too quick to assume the original server_name value isn't being passed through because this is "not CGI". I don't think that's the issue at all. I think it is being overwritten at some point in the httpd -> mod_proxy -> mod_cfml -> tomcat -> railo processing chain and I can probably prevent that if I knew where.
– SpliFF
Feb 3 '14 at 4:45
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f571740%2fapache-usecanonicalname-on-isnt-passing-servername-to-cgi%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You're not calling a CGI, you're proxying, so trying to set SERVER_NAME is either useless or very close to it.
Typically with mass virtual hosting you should use the actual domain name that you received, which is HTTP_HOST, the Host:
HTTP header, in your application to make the distinction.
That makes some sense except that CFML engines DO emulate CGI and provide a CGI scope containing the fields you would expect. For point 2 I do not want seperate "contexts" based on the FQDN used by the client. What I want is many FQDN aliases all pointing to the same "shortname" context. I do want to preserve the 'Host' header information but I need the "true" ServerName as well.
– SpliFF
Feb 3 '14 at 4:31
Hmm. You'll have to get it elsewhere, then, I think. Perhaps that mysterious header you mentioned? It should only take a moment to test whether that behaves the way you expect.
– Michael Hampton♦
Feb 3 '14 at 4:32
Thanks but I think you're too quick to assume the original server_name value isn't being passed through because this is "not CGI". I don't think that's the issue at all. I think it is being overwritten at some point in the httpd -> mod_proxy -> mod_cfml -> tomcat -> railo processing chain and I can probably prevent that if I knew where.
– SpliFF
Feb 3 '14 at 4:45
add a comment |
You're not calling a CGI, you're proxying, so trying to set SERVER_NAME is either useless or very close to it.
Typically with mass virtual hosting you should use the actual domain name that you received, which is HTTP_HOST, the Host:
HTTP header, in your application to make the distinction.
That makes some sense except that CFML engines DO emulate CGI and provide a CGI scope containing the fields you would expect. For point 2 I do not want seperate "contexts" based on the FQDN used by the client. What I want is many FQDN aliases all pointing to the same "shortname" context. I do want to preserve the 'Host' header information but I need the "true" ServerName as well.
– SpliFF
Feb 3 '14 at 4:31
Hmm. You'll have to get it elsewhere, then, I think. Perhaps that mysterious header you mentioned? It should only take a moment to test whether that behaves the way you expect.
– Michael Hampton♦
Feb 3 '14 at 4:32
Thanks but I think you're too quick to assume the original server_name value isn't being passed through because this is "not CGI". I don't think that's the issue at all. I think it is being overwritten at some point in the httpd -> mod_proxy -> mod_cfml -> tomcat -> railo processing chain and I can probably prevent that if I knew where.
– SpliFF
Feb 3 '14 at 4:45
add a comment |
You're not calling a CGI, you're proxying, so trying to set SERVER_NAME is either useless or very close to it.
Typically with mass virtual hosting you should use the actual domain name that you received, which is HTTP_HOST, the Host:
HTTP header, in your application to make the distinction.
You're not calling a CGI, you're proxying, so trying to set SERVER_NAME is either useless or very close to it.
Typically with mass virtual hosting you should use the actual domain name that you received, which is HTTP_HOST, the Host:
HTTP header, in your application to make the distinction.
answered Feb 3 '14 at 4:21
Michael Hampton♦Michael Hampton
174k27319644
174k27319644
That makes some sense except that CFML engines DO emulate CGI and provide a CGI scope containing the fields you would expect. For point 2 I do not want seperate "contexts" based on the FQDN used by the client. What I want is many FQDN aliases all pointing to the same "shortname" context. I do want to preserve the 'Host' header information but I need the "true" ServerName as well.
– SpliFF
Feb 3 '14 at 4:31
Hmm. You'll have to get it elsewhere, then, I think. Perhaps that mysterious header you mentioned? It should only take a moment to test whether that behaves the way you expect.
– Michael Hampton♦
Feb 3 '14 at 4:32
Thanks but I think you're too quick to assume the original server_name value isn't being passed through because this is "not CGI". I don't think that's the issue at all. I think it is being overwritten at some point in the httpd -> mod_proxy -> mod_cfml -> tomcat -> railo processing chain and I can probably prevent that if I knew where.
– SpliFF
Feb 3 '14 at 4:45
add a comment |
That makes some sense except that CFML engines DO emulate CGI and provide a CGI scope containing the fields you would expect. For point 2 I do not want seperate "contexts" based on the FQDN used by the client. What I want is many FQDN aliases all pointing to the same "shortname" context. I do want to preserve the 'Host' header information but I need the "true" ServerName as well.
– SpliFF
Feb 3 '14 at 4:31
Hmm. You'll have to get it elsewhere, then, I think. Perhaps that mysterious header you mentioned? It should only take a moment to test whether that behaves the way you expect.
– Michael Hampton♦
Feb 3 '14 at 4:32
Thanks but I think you're too quick to assume the original server_name value isn't being passed through because this is "not CGI". I don't think that's the issue at all. I think it is being overwritten at some point in the httpd -> mod_proxy -> mod_cfml -> tomcat -> railo processing chain and I can probably prevent that if I knew where.
– SpliFF
Feb 3 '14 at 4:45
That makes some sense except that CFML engines DO emulate CGI and provide a CGI scope containing the fields you would expect. For point 2 I do not want seperate "contexts" based on the FQDN used by the client. What I want is many FQDN aliases all pointing to the same "shortname" context. I do want to preserve the 'Host' header information but I need the "true" ServerName as well.
– SpliFF
Feb 3 '14 at 4:31
That makes some sense except that CFML engines DO emulate CGI and provide a CGI scope containing the fields you would expect. For point 2 I do not want seperate "contexts" based on the FQDN used by the client. What I want is many FQDN aliases all pointing to the same "shortname" context. I do want to preserve the 'Host' header information but I need the "true" ServerName as well.
– SpliFF
Feb 3 '14 at 4:31
Hmm. You'll have to get it elsewhere, then, I think. Perhaps that mysterious header you mentioned? It should only take a moment to test whether that behaves the way you expect.
– Michael Hampton♦
Feb 3 '14 at 4:32
Hmm. You'll have to get it elsewhere, then, I think. Perhaps that mysterious header you mentioned? It should only take a moment to test whether that behaves the way you expect.
– Michael Hampton♦
Feb 3 '14 at 4:32
Thanks but I think you're too quick to assume the original server_name value isn't being passed through because this is "not CGI". I don't think that's the issue at all. I think it is being overwritten at some point in the httpd -> mod_proxy -> mod_cfml -> tomcat -> railo processing chain and I can probably prevent that if I knew where.
– SpliFF
Feb 3 '14 at 4:45
Thanks but I think you're too quick to assume the original server_name value isn't being passed through because this is "not CGI". I don't think that's the issue at all. I think it is being overwritten at some point in the httpd -> mod_proxy -> mod_cfml -> tomcat -> railo processing chain and I can probably prevent that if I knew where.
– SpliFF
Feb 3 '14 at 4:45
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f571740%2fapache-usecanonicalname-on-isnt-passing-servername-to-cgi%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown