xecute
xecute

Reputation: 455

nginx rewrite rule missing slash

I have a thumbnail class and it accepts external hosts too. It works like this right now :

http://mysite.com/resize/src=http://google.com/logo.png&w=50&h=50

I want to make it clean url with my "resize.mysite.com" subdomain like this :

http://resize.mysite.com/400x200/http://google.com/logo.png

I almost done it with this rewrite rule :

rewrite ^/([^x]*)x([^/]*)/(.*)$ /resize.php?w=$1&h=$2&src=$3 last;

But it's sending "src" without second slash after "http:" and it causes to resize class error, like this :

http:/google.com/logo.png
http://google.com/logo.png (what I expect)

How this can be fixed?

Upvotes: 1

Views: 405

Answers (1)

Michał Kupisiński
Michał Kupisiński

Reputation: 3863

The first thing comes in mind is that your are using somewhere in your nginx configuration file special directive merge_slashes, is it true? If yes and your are using merge_slashes on then all your requests with double or triple and so on slashes will comes as one slash.

Can it be a solution to your problem to set directive merge_slashes off ?

Upvotes: 2

Related Questions