Comments (8)
Redirects work fine in rApache. Not sure what you're doing, but this works with rApache handlers like so:
# Apache conf
<Location /test/relocation>
SetHandler r-handler
RFileHandler @DOCROOT@/relocation.R::handler
</Location>
</code>
and R code:
# relocation.R
handler <- function(){
loc <- '/index.html'
if (!is.null(GET) && !is.null(GET$loc) && GET$loc != '')
loc <- GET$loc
setHeader("Location",loc)
return(HTTP_MOVED_TEMPORARILY)
}
from rapache.
Hmz maybe it is because I am still using rapache 1.14. Whenever I use setHeader, the HTTP 200 is already sent as it seems.
from rapache.
I updated to rapache 1.18 can't get it to work. I created a file /var/www/R-files/test.rhtml
with the following content:
cat("This is a test!");
setContentType(type='text/plain')
setHeader("Location", "http://www.google.com");
return(HTTP_MOVED_TEMPORARILY);
Then when I download it with curl, I see a HTTP 200 instead:
curl -i http://127.0.0.1/R-files/test.rhtml
HTTP/1.1 200 OK
Date: Fri, 06 Apr 2012 17:54:46 GMT
Server: Apache/2.2.20 (Ubuntu)
Location: http://www.google.com
Vary: Accept-Encoding
Transfer-Encoding: chunked
Content-Type: text/plain
This is a test!
from rapache.
Get rid of the cat statement and it will work. Not sure about that HTTP
spec but if you're going to redirect the user to another url then they will
never see the request body anyway.
On Apr 6, 2012 12:57 PM, "jeroenooms" <
[email protected]>
wrote:
I still can't get it to work. I created a file
/var/www/R-files/test.rhtml
with the following content:cat("This is a test!");
setContentType(type='text/plain')
setHeader("Location", "http://www.google.com");
return(HTTP_MOVED_TEMPORARILY);Then when I download it with curl, I see a HTTP 200 instead:
curl -i http://127.0.0.1/R-files/test.rhtml
HTTP/1.1 200 OK
Date: Fri, 06 Apr 2012 17:54:46 GMT
Server: Apache/2.2.20 (Ubuntu)
Location: http://www.google.com
Vary: Accept-Encoding
Transfer-Encoding: chunked
Content-Type: text/plainThis is a test!
Reply to this email directly or view it on GitHub:
#3 (comment)
from rapache.
It doesn't work for me. Still get to see a HTTP 200, even without the text in the body.
from rapache.
What's your apache conf look like for this url?
On Mon, Apr 9, 2012 at 2:40 PM, jeroenooms
[email protected]
wrote:
It doesn't work for me. Still get to see a HTTP 200.
Reply to this email directly or view it on GitHub:
#3 (comment)
from rapache.
I just used my debugging config:
<Directory /var/www/R-files>
SetHandler r-script
RHandler sys.source
</Directory>
and then /var/www/R-files/test
contains:
setHeader("Location", "http://www.google.com");
return(HTTP_MOVED_TEMPORARILY)
from rapache.
Okay, I've figured out why: sys.source returns invisible() which
essentially returns NULL to rApache. Therefore rApache will always
returns DONE.
Easiest thing to do is create your own handler.
Jeff
On Mon, Apr 9, 2012 at 2:50 PM, jeroenooms
[email protected]
wrote:
I just used my debugging config:
<Directory /var/www/R-files>
SetHandler r-script
RHandler sys.source
and then
/var/www/R-files/test
contains:setHeader("Location", "http://www.google.com");
return(HTTP_MOVED_TEMPORARILY)
Reply to this email directly or view it on GitHub:
#3 (comment)
from rapache.
Related Issues (20)
- rApache on Centos 6.6 with apache 2.4 HOT 22
- Broken links HOT 1
- microsoft r open HOT 2
- Rapache is not able to fetch the request when RGoogleAnalytics package is used
- exceptions in RSourceOnStartup are not logged or sent to stderr HOT 1
- Process or memory? HOT 2
- Update RPM spec file version to latest (1.2.8) HOT 8
- Installing RApache in Ubuntu 16.04 Apache/2.4.18 (Ubuntu): I get some errors HOT 4
- How do you install additional packages?
- Ability to kill the apache process from an R script? HOT 4
- Setting UTF-8 HOT 2
- rApache not reading ldpaths HOT 11
- Integer overflow for posts over 1GB HOT 8
- Question: concurrent requests? HOT 2
- rApache notice! *** stack smashing detected *** with mailR::send_mail
- Rsource and RreqHandler not supported? HOT 1
- Your website www.rapache.net has been hacked HOT 2
- Installation error HOT 1
- RInfo handler not working on R version 4.1.1 (2021-08-10)
- arm64 compilation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rapache.