If you have
pain under your right rib then there could be a liver infection,
pancreatitis, or a gall bladder problem. Get a liver function test, ultrasound or CT of abdomen, and pancreatic enzymes. It can also be due to acidity and duodenal ulcer. Take a late night snack. Raise head end of bed. Take Omeprazole empty stomach in morning and an antacid gel at bedtime. Refrain from smoking, alcohol, fuzzy drinks and spicy food.
Do discuss this with your doctor and get yourself examined. Take care!