Welcome! Log In Create A New Profile

Advanced

Rewrite rule for Railo coldfusion server and cfwheels framework

Posted by t0lkman 
Rewrite rule for Railo coldfusion server and cfwheels framework
June 03, 2010 08:55PM
Hi there,
I need help with rewrite rule, here is my site config:

server {
listen 80;
server_name pm.myunster.com;
index index.cfm index.htm index.html;
if (!-e $request_filename) {
rewrite ^/index.cfm/?(.*)$ /index.cfm$1 last;
rewrite ^/(.*)$ /rewrite.cfm$1 last;
}
location ~ \.cfm {
proxy_pass http://127.0.0.1:8888;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded_For $proxy_add_x_forwarded_for;
break;
}
location ~ / {
root /www/pm;
expires 90d;
}
}


As you see the problem here that I can't never reach /www/pm
because rewrite rule is outside of location scope. However all *.cfm files work well

However if I use

server {
listen 80;
server_name pm.myunster.com;
index index.cfm index.htm index.html;
location ~ \.cfm {
if (!-e $request_filename) {
rewrite ^/index.cfm/?(.*)$ /index.cfm$1 last;
rewrite ^/(.*)$ /rewrite.cfm$1 last;
}
proxy_pass http://127.0.0.1:8888;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded_For $proxy_add_x_forwarded_for;
break;
}
location ~ / {
root /www/pm;
expires 90d;
}
}

So I can reach my static content inside /www/pm but first location goes to infinite loop

How can i fix my problem?
Probably somewhere here - "location ~ \.cfm {" I have to add if NOT (index.cfm|rewrite.cfm)
then go inside "location ~ \.cfm {"

or may be you can suggest anything else?

All the idea is static content goes to /www/pm all *.cfm requests redirect to http://127.0.0.1:8888 by proxy_pass
but the most important thing for cfwheels framework I need keep the rewrite rules
rewrite ^/index.cfm/?(.*)$ /index.cfm$1 last;
rewrite ^/(.*)$ /rewrite.cfm$1 last;
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 141
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready