You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by An...@gdc4s.com on 2011/04/11 23:26:49 UTC

[users@httpd] internal redirect

I have a web server which provides web services at the url
http://someplace:port/SERVICES/

There is client software which I don't have source code to which allow
you me to specify http://someplace:port.
However, this client will always send its web service posts to
http://someplace:port/SERVICES on the wire.   Notice the trailing slash
is missing.
For security reasons, this client will NOT follow redirects.   
However, I cannot seem to get apache to append the slash and do an
internal redirect.
I have tried Alias, but the Redirects are processed first.
I have used the rewrite engine to successfully rewrite the URL to put
the slash on, but it still sends an external redirect.

How can I get apache to do an internal redirect, and NOT send an
external redirect.  
In our case, the internal redirect is safe since the SERVICES/  url is
the only url the client will ever access. 

Thanks,
Tony

RE: [users@httpd] internal redirect

Posted by An...@gdc4s.com.
So I finally got this legacy web client to run my services successfully
by the following line of reasoning:  If he is hardcoded to POST to
http://mydomain:myport/WebService  with no trailing slash, then I
created a file in my htdocs directory named WebService.php and used the
Rewriting Engine as follows:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^.])$ /$1.php


This works for my http interface, but on my https interface using a
separate virtual server, the web server sends back a 406 Not Acceptable,
saying an appropriate representation could not be found.  He also sends
back "Avaliable Variants:  WebService.php type application/x-httpd-php"

So, how can I get the Virtual Server to also run the WebServer.php?

Thanks
Tony

-----Original Message-----
From: Brown, Tony-P56943 
Sent: Tuesday, April 12, 2011 10:04 AM
To: 'users@httpd.apache.org'
Subject: RE: [users@httpd] internal redirect

According to the apache documentation for mod_alias

"First, all Redirects are processed before Aliases are processed, and
therefore a request that matches a Redirect or RedirectMatch will never
have Aliases applied."

Without the trailing slash, the web server applies the slash and sends a
redirect to the client. My aliases are ignored.  This would not be a
problem except that the legacy client software will not follow
redirects.  He will simply say he could not connect to the web service.
Perhaps one could consider this to be broken, but we have a need to make
this legacy client connect to our web service.  Additionally, this
particular web service client has never previously been used with an
apache web server, it was built to work with some java based web server
on Win2K3.

-----Original Message-----
From: Nick Kew [mailto:nick@webthing.com] 
Sent: Monday, April 11, 2011 3:54 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] internal redirect

On Mon, 11 Apr 2011 14:26:49 -0700
<An...@gdc4s.com> wrote:

> I have a web server which provides web services at the url
> http://someplace:port/SERVICES/

If that's apache, you can provide services at your choice of URL,
with or without the slash.

> There is client software which [...]

Are you sure?  Sounds broken.

> I have tried Alias, but the Redirects are processed first.

What redirects?

If you mean mod_dir appending a trailing slash, disable it.
If something else, find out what it is and stop it.

> I have used the rewrite engine

An excellent instrument with which to shoot yourself in the foot.

> How can I get apache to do an internal redirect, and NOT send an
> external redirect.  

Alias.

But far better to have matching expectations at the client and server,
by configuring your service at /SERVICES in the first place:
<Location /SERVICES>
	SetHandler my-web-service
</Location>

-- 
Nick Kew

Available for work, contract or permanent.
http://www.webthing.com/~nick/cv.html

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] internal redirect

Posted by An...@gdc4s.com.
According to the apache documentation for mod_alias

"First, all Redirects are processed before Aliases are processed, and
therefore a request that matches a Redirect or RedirectMatch will never
have Aliases applied."

Without the trailing slash, the web server applies the slash and sends a
redirect to the client. My aliases are ignored.  This would not be a
problem except that the legacy client software will not follow
redirects.  He will simply say he could not connect to the web service.
Perhaps one could consider this to be broken, but we have a need to make
this legacy client connect to our web service.  Additionally, this
particular web service client has never previously been used with an
apache web server, it was built to work with some java based web server
on Win2K3.

-----Original Message-----
From: Nick Kew [mailto:nick@webthing.com] 
Sent: Monday, April 11, 2011 3:54 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] internal redirect

On Mon, 11 Apr 2011 14:26:49 -0700
<An...@gdc4s.com> wrote:

> I have a web server which provides web services at the url
> http://someplace:port/SERVICES/

If that's apache, you can provide services at your choice of URL,
with or without the slash.

> There is client software which [...]

Are you sure?  Sounds broken.

> I have tried Alias, but the Redirects are processed first.

What redirects?

If you mean mod_dir appending a trailing slash, disable it.
If something else, find out what it is and stop it.

> I have used the rewrite engine

An excellent instrument with which to shoot yourself in the foot.

> How can I get apache to do an internal redirect, and NOT send an
> external redirect.  

Alias.

But far better to have matching expectations at the client and server,
by configuring your service at /SERVICES in the first place:
<Location /SERVICES>
	SetHandler my-web-service
</Location>

-- 
Nick Kew

Available for work, contract or permanent.
http://www.webthing.com/~nick/cv.html

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] internal redirect

Posted by Nick Kew <ni...@webthing.com>.
On Mon, 11 Apr 2011 14:26:49 -0700
<An...@gdc4s.com> wrote:

> I have a web server which provides web services at the url
> http://someplace:port/SERVICES/

If that's apache, you can provide services at your choice of URL,
with or without the slash.

> There is client software which [...]

Are you sure?  Sounds broken.

> I have tried Alias, but the Redirects are processed first.

What redirects?

If you mean mod_dir appending a trailing slash, disable it.
If something else, find out what it is and stop it.

> I have used the rewrite engine

An excellent instrument with which to shoot yourself in the foot.

> How can I get apache to do an internal redirect, and NOT send an
> external redirect.  

Alias.

But far better to have matching expectations at the client and server,
by configuring your service at /SERVICES in the first place:
<Location /SERVICES>
	SetHandler my-web-service
</Location>

-- 
Nick Kew

Available for work, contract or permanent.
http://www.webthing.com/~nick/cv.html

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org